summaryrefslogtreecommitdiff
path: root/chromium/third_party/libxml/src/parser.c
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/third_party/libxml/src/parser.c')
-rw-r--r--chromium/third_party/libxml/src/parser.c60
1 files changed, 41 insertions, 19 deletions
diff --git a/chromium/third_party/libxml/src/parser.c b/chromium/third_party/libxml/src/parser.c
index 4e767091683..3a8a0d79e96 100644
--- a/chromium/third_party/libxml/src/parser.c
+++ b/chromium/third_party/libxml/src/parser.c
@@ -2081,8 +2081,8 @@ static void xmlSHRINK (xmlParserCtxtPtr ctxt) {
xmlGROW (ctxt);
static void xmlGROW (xmlParserCtxtPtr ctxt) {
- ptrdiff_t curEnd = ctxt->input->end - ctxt->input->cur;
- ptrdiff_t curBase = ctxt->input->cur - ctxt->input->base;
+ unsigned long curEnd = ctxt->input->end - ctxt->input->cur;
+ unsigned long curBase = ctxt->input->cur - ctxt->input->base;
if (((curEnd > (unsigned long) XML_MAX_LOOKUP_LIMIT) ||
(curBase > (unsigned long) XML_MAX_LOOKUP_LIMIT)) &&
@@ -8857,18 +8857,6 @@ xmlParseQNameAndCompare(xmlParserCtxtPtr ctxt, xmlChar const *name,
* caller if it was copied, this can be detected by val[*len] == 0.
*/
-#define GROW_PARSE_ATT_VALUE_INTERNAL(ctxt, in, start, end) \
- const xmlChar *oldbase = ctxt->input->base;\
- GROW;\
- if (ctxt->instate == XML_PARSER_EOF)\
- return(NULL);\
- if (oldbase != ctxt->input->base) {\
- ptrdiff_t delta = ctxt->input->base - oldbase;\
- start = start + delta;\
- in = in + delta;\
- }\
- end = ctxt->input->end;
-
static xmlChar *
xmlParseAttValueInternal(xmlParserCtxtPtr ctxt, int *len, int *alloc,
int normalize)
@@ -8898,7 +8886,14 @@ xmlParseAttValueInternal(xmlParserCtxtPtr ctxt, int *len, int *alloc,
end = ctxt->input->end;
start = in;
if (in >= end) {
- GROW_PARSE_ATT_VALUE_INTERNAL(ctxt, in, start, end)
+ const xmlChar *oldbase = ctxt->input->base;
+ GROW;
+ if (oldbase != ctxt->input->base) {
+ long delta = ctxt->input->base - oldbase;
+ start = start + delta;
+ in = in + delta;
+ }
+ end = ctxt->input->end;
}
if (normalize) {
/*
@@ -8915,7 +8910,16 @@ xmlParseAttValueInternal(xmlParserCtxtPtr ctxt, int *len, int *alloc,
in++;
start = in;
if (in >= end) {
- GROW_PARSE_ATT_VALUE_INTERNAL(ctxt, in, start, end)
+ const xmlChar *oldbase = ctxt->input->base;
+ GROW;
+ if (ctxt->instate == XML_PARSER_EOF)
+ return(NULL);
+ if (oldbase != ctxt->input->base) {
+ long delta = ctxt->input->base - oldbase;
+ start = start + delta;
+ in = in + delta;
+ }
+ end = ctxt->input->end;
if (((in - start) > XML_MAX_TEXT_LENGTH) &&
((ctxt->options & XML_PARSE_HUGE) == 0)) {
xmlFatalErrMsg(ctxt, XML_ERR_ATTRIBUTE_NOT_FINISHED,
@@ -8929,7 +8933,16 @@ xmlParseAttValueInternal(xmlParserCtxtPtr ctxt, int *len, int *alloc,
col++;
if ((*in++ == 0x20) && (*in == 0x20)) break;
if (in >= end) {
- GROW_PARSE_ATT_VALUE_INTERNAL(ctxt, in, start, end)
+ const xmlChar *oldbase = ctxt->input->base;
+ GROW;
+ if (ctxt->instate == XML_PARSER_EOF)
+ return(NULL);
+ if (oldbase != ctxt->input->base) {
+ long delta = ctxt->input->base - oldbase;
+ start = start + delta;
+ in = in + delta;
+ }
+ end = ctxt->input->end;
if (((in - start) > XML_MAX_TEXT_LENGTH) &&
((ctxt->options & XML_PARSE_HUGE) == 0)) {
xmlFatalErrMsg(ctxt, XML_ERR_ATTRIBUTE_NOT_FINISHED,
@@ -8958,7 +8971,7 @@ xmlParseAttValueInternal(xmlParserCtxtPtr ctxt, int *len, int *alloc,
if (ctxt->instate == XML_PARSER_EOF)
return(NULL);
if (oldbase != ctxt->input->base) {
- ptrdiff_t delta = ctxt->input->base - oldbase;
+ long delta = ctxt->input->base - oldbase;
start = start + delta;
in = in + delta;
last = last + delta;
@@ -8985,7 +8998,16 @@ xmlParseAttValueInternal(xmlParserCtxtPtr ctxt, int *len, int *alloc,
in++;
col++;
if (in >= end) {
- GROW_PARSE_ATT_VALUE_INTERNAL(ctxt, in, start, end)
+ const xmlChar *oldbase = ctxt->input->base;
+ GROW;
+ if (ctxt->instate == XML_PARSER_EOF)
+ return(NULL);
+ if (oldbase != ctxt->input->base) {
+ long delta = ctxt->input->base - oldbase;
+ start = start + delta;
+ in = in + delta;
+ }
+ end = ctxt->input->end;
if (((in - start) > XML_MAX_TEXT_LENGTH) &&
((ctxt->options & XML_PARSE_HUGE) == 0)) {
xmlFatalErrMsg(ctxt, XML_ERR_ATTRIBUTE_NOT_FINISHED,