* mandoc: Fix UTF-16 surrogate detection: lower case variants have to be
@ 2024-05-16 21:23 schwarze
0 siblings, 0 replies; only message in thread
From: schwarze @ 2024-05-16 21:23 UTC (permalink / raw)
To: source
Log Message:
-----------
Fix UTF-16 surrogate detection:
lower case variants have to be rejected, too.
Modified Files:
--------------
mandoc:
roff_escape.c
Revision Data
-------------
Index: roff_escape.c
===================================================================
RCS file: /home/cvs/mandoc/mandoc/roff_escape.c,v
diff -Lroff_escape.c -Lroff_escape.c -u -p -r1.14 -r1.15
--- roff_escape.c
+++ roff_escape.c
@@ -467,13 +467,12 @@ roff_escape(const char *buf, const int l
/*
* Unicode escapes are defined in groff as \[u0000]
* to \[u10FFFF], where the contained value must be
- * a valid Unicode codepoint. Here, however, only
- * check the length and range.
+ * a valid Unicode codepoint.
*/
if (buf[iarg] != 'u' || argl < 5 || argl > 7)
break;
- if (argl == 7 &&
+ if (argl == 7 && /* beyond the Unicode range */
(buf[iarg + 1] != '1' || buf[iarg + 2] != '0')) {
err = MANDOCERR_ESC_BADCHAR;
break;
@@ -482,8 +481,9 @@ roff_escape(const char *buf, const int l
err = MANDOCERR_ESC_BADCHAR;
break;
}
- if (argl == 5 && buf[iarg + 1] == 'D' &&
- strchr("89ABCDEF", buf[iarg + 2]) != NULL) {
+ if (argl == 5 && /* UTF-16 surrogate */
+ toupper((unsigned char)buf[iarg + 1]) == 'D' &&
+ strchr("89ABCDEFabcdef", buf[iarg + 2]) != NULL) {
err = MANDOCERR_ESC_BADCHAR;
break;
}
--
To unsubscribe send an email to source+unsubscribe@mandoc.bsd.lv
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-05-16 21:23 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-16 21:23 mandoc: Fix UTF-16 surrogate detection: lower case variants have to be schwarze
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).