Fix percentage validation in CheckLength (#912)

Fixes #910
This commit is contained in:
Caleb Callaway 2020-11-22 10:45:32 -08:00 committed by GitHub
parent c0e6d6807e
commit 20f1e3c7bc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1856,13 +1856,19 @@ void CheckLength( TidyDocImpl* doc, Node *node, AttVal *attval)
} }
else else
{ {
Bool percentFound = no;
while (*p) while (*p)
{ {
if (!TY_(IsDigit)(*p) && *p != '%') if (!percentFound && *p == '%')
{
percentFound = yes;
}
else if (percentFound || !TY_(IsDigit)(*p))
{ {
TY_(ReportAttrError)( doc, node, attval, BAD_ATTRIBUTE_VALUE); TY_(ReportAttrError)( doc, node, attval, BAD_ATTRIBUTE_VALUE);
break; break;
} }
++p; ++p;
} }
} }