Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F142589141
D42147.id128516.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D42147.id128516.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D42147: tty/teken: fix UTF8 sequence validation logic
Attached
Detach File
Event Timeline
Log In to Comment