Fixes #798. Version bump due to potential behavior change.

This commit is contained in:
Jim Derry 2021-07-09 15:39:37 -04:00
parent d54dcda389
commit 8d3019da22
2 changed files with 7 additions and 5 deletions

View File

@ -1035,7 +1035,7 @@ static SPStatus GetSurrogatePair(TidyDocImpl* doc, Bool isXml, uint *pch)
{ {
Lexer* lexer = doc->lexer; Lexer* lexer = doc->lexer;
uint bufSize = 32; uint bufSize = 32;
uint c, ch, offset = 0; uint c, ch = 0, offset = 0;
tmbstr buf = 0; tmbstr buf = 0;
SPStatus status = SP_error; /* assume failed */ SPStatus status = SP_error; /* assume failed */
int type = 0; /* assume numeric */ int type = 0; /* assume numeric */
@ -1088,13 +1088,15 @@ static SPStatus GetSurrogatePair(TidyDocImpl* doc, Bool isXml, uint *pch)
if (c == ';') if (c == ';')
{ {
int scanned;
buf[offset] = 0; buf[offset] = 0;
if (type) if (type)
sscanf(buf + 2, "%x", &ch); scanned = sscanf(buf + 2, "%x", &ch);
else else
sscanf(buf + 1, "%d", &ch); scanned = sscanf(buf + 1, "%d", &ch);
if (TY_(IsHighSurrogate)(ch)) if (scanned == 1 && TY_(IsHighSurrogate)(ch))
{ {
ch = TY_(CombineSurrogatePair)(ch, fch); ch = TY_(CombineSurrogatePair)(ch, fch);
if (TY_(IsValidCombinedChar)(ch)) if (TY_(IsValidCombinedChar)(ch))

View File

@ -1,2 +1,2 @@
5.7.56 5.7.57
2021.07.09 2021.07.09