diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2015-10-13 23:30:50 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2015-10-13 23:30:50 +0000 |
commit | cb192ac4eef122c00382d72fb72b907fd07e3516 (patch) | |
tree | 26828ad1e0df8603353e6c2eed7a5f351eef2678 | |
parent | b26f648a71b3259c793410232a0d3bbdd0aa54e3 (diff) | |
download | mandoc-cb192ac4eef122c00382d72fb72b907fd07e3516.tar.gz |
Reject the escape sequences \[uD800] to \[uDFFF] in the parser.
These surrogates are not valid Unicode codepoints,
so treat them just like any other undefined character escapes:
Warn about them and do not produce output.
Issue noticed while talking to stsp@, semarie@, and bentley@.
-rw-r--r-- | mandoc.c | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -333,6 +333,9 @@ mandoc_escape(const char **end, const char **start, int *sz) break; if (*sz == 6 && (*start)[1] == '0') break; + if (*sz == 5 && (*start)[1] == 'D' && + strchr("89ABCDEF", (*start)[2]) != NULL) + break; if ((int)strspn(*start + 1, "0123456789ABCDEFabcdef") + 1 == *sz) gly = ESCAPE_UNICODE; |