1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2024-10-26 20:25:14 +03:00

Fix sanity check in htmlParseNameComplex

- (cur - len) can overflow.
- Throw an internal error.

Fixes bug 780077.
This commit is contained in:
Nick Wellnhofer 2017-06-11 12:35:59 +02:00
parent 79c8a6b105
commit f39e3be0dd

View File

@ -2528,8 +2528,12 @@ htmlParseNameComplex(xmlParserCtxtPtr ctxt) {
}
}
if (ctxt->input->base > ctxt->input->cur - len)
return(NULL);
if (ctxt->input->cur - ctxt->input->base < len) {
/* Sanity check */
htmlParseErr(ctxt, XML_ERR_INTERNAL_ERROR,
"unexpected change of input buffer", NULL, NULL);
return (NULL);
}
return(xmlDictLookup(ctxt->dict, ctxt->input->cur - len, len));
}