=================================================================== RCS file: /cvs/mandoc/mandoc.c,v retrieving revision 1.87 retrieving revision 1.88 diff -u -p -r1.87 -r1.88 --- mandoc/mandoc.c 2014/10/13 17:17:45 1.87 +++ mandoc/mandoc.c 2014/10/28 13:24:44 1.88 @@ -1,4 +1,4 @@ -/* $Id: mandoc.c,v 1.87 2014/10/13 17:17:45 schwarze Exp $ */ +/* $Id: mandoc.c,v 1.88 2014/10/28 13:24:44 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons * Copyright (c) 2011, 2012, 2013, 2014 Ingo Schwarze @@ -334,13 +334,18 @@ mandoc_escape(const char **end, const char **start, in if (1 == *sz && 'c' == **start) gly = ESCAPE_NOSPACE; /* - * Unicode escapes are defined in groff as \[uXXXX] + * 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 the validity of all digits. + * check the length and range. */ - else if (*sz > 4 && *sz < 8 && **start == 'u' && - (int)strspn(*start + 1, "0123456789ABCDEFabcdef") + if (**start != 'u' || *sz < 5 || *sz > 7) + break; + if (*sz == 7 && ((*start)[1] != '1' || (*start)[2] != '0')) + break; + if (*sz == 6 && (*start)[1] == '0') + break; + if ((int)strspn(*start + 1, "0123456789ABCDEFabcdef") + 1 == *sz) gly = ESCAPE_UNICODE; break;