aboutsummaryrefslogtreecommitdiffstats
path: root/parser.c
diff options
context:
space:
mode:
authorBrian C. Young <bcyoung@google.com>2017-04-03 12:21:57 -0700
committergitbuildkicker <android-build@google.com>2017-04-17 16:24:07 -0700
commitff20cd797822dba8569ee518c44e6864d6b4ebfa (patch)
tree2404b82811e32c7af6dbd7bdc11e45de3faf43b2 /parser.c
parent6690f19b09a6bf47660a7d87b21860c5beaac8be (diff)
downloadandroid_external_libxml2-ff20cd797822dba8569ee518c44e6864d6b4ebfa.tar.gz
android_external_libxml2-ff20cd797822dba8569ee518c44e6864d6b4ebfa.tar.bz2
android_external_libxml2-ff20cd797822dba8569ee518c44e6864d6b4ebfa.zip
DO NOT MERGE: Apply upstream Chromium patch for encoding changes
Give up looking up interned names if the encoding changed during parsing NEXTL may process encoding changes by refilling the parser's input buffer, which makes the accumulated length 'len' inaccurate. Chromium bug: http://crbug.com/620679 Review-Url: https://codereview.chromium.org/2603933002 Cr-Commit-Position: refs/heads/master@{#442517} Bug: 36553781 Change-Id: Id3484fbee201d1e19b684b109009d6590354b1d9 (cherry picked from commit 008262d3e46b3d5aae2d2f981e26ca69c8bd2b51)
Diffstat (limited to 'parser.c')
-rw-r--r--parser.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/parser.c b/parser.c
index 53a6b7f0..669cd57f 100644
--- a/parser.c
+++ b/parser.c
@@ -3420,8 +3420,15 @@ xmlParseNameComplex(xmlParserCtxtPtr ctxt) {
xmlFatalErr(ctxt, XML_ERR_NAME_TOO_LONG, "Name");
return(NULL);
}
- if ((*ctxt->input->cur == '\n') && (ctxt->input->cur[-1] == '\r'))
+ if (ctxt->input->cur > ctxt->input->base && (*ctxt->input->cur == '\n') && (ctxt->input->cur[-1] == '\r')) {
+ if (ctxt->input->base > ctxt->input->cur - (len + 1)) {
+ return(NULL);
+ }
return(xmlDictLookup(ctxt->dict, ctxt->input->cur - (len + 1), len));
+ }
+ if (ctxt->input->base > ctxt->input->cur - len) {
+ return(NULL);
+ }
return(xmlDictLookup(ctxt->dict, ctxt->input->cur - len, len));
}