Page MenuHomeFreeBSD

D42147.id128516.diff
No OneTemporary

D42147.id128516.diff

Index: sys/kern/tty_ttydisc.c
===================================================================
--- sys/kern/tty_ttydisc.c
+++ sys/kern/tty_ttydisc.c
@@ -844,6 +844,7 @@
*/
ttyinq_write(&tp->t_inq, bytes,
UTF8_STACKBUF, 0);
+ ttyinq_unputchar(&tp->t_inq);
} else {
/* Find codepoint and width. */
codepoint =
@@ -861,6 +862,7 @@
*/
ttyinq_write(&tp->t_inq, bytes,
nb, 0);
+ ttyinq_unputchar(&tp->t_inq);
}
}
tp->t_column -= cwidth;
Index: sys/teken/teken_wcwidth.h
===================================================================
--- sys/teken/teken_wcwidth.h
+++ sys/teken/teken_wcwidth.h
@@ -128,8 +128,11 @@
teken_utf8_bytes_to_codepoint(uint8_t bytes[4], int nbytes)
{
- /* Check for malformed characters. */
- if (bitcount(bytes[0] & 0xf0) != nbytes)
+ /*
+ * Check for malformed characters by comparing 'nbytes' to
+ * the number of consecutive bits set starting from the MSB.
+ */
+ if (__builtin_clz(~(bytes[0] & 0xf0) << 24) != nbytes)
return (TEKEN_UTF8_INVALID_CODEPOINT);
switch (nbytes) {

File Metadata

Mime Type
text/plain
Expires
Thu, Jan 22, 7:44 AM (4 h, 26 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
27835342
Default Alt Text
D42147.id128516.diff (1 KB)

Event Timeline