diff options
| author | akirilov <akirilov@google.com> | 2018-06-01 13:46:04 -0700 |
|---|---|---|
| committer | syphyr <syphyr@gmail.com> | 2018-09-06 04:08:09 +0200 |
| commit | 126c3993d2ad55db2abfe80e3d671bf584e7b13b (patch) | |
| tree | f4464c225863c997e3f99d9897131f9f28df76fe /parserInternals.c | |
| parent | 521b88fbb6d18312923f0df653d045384b500ffc (diff) | |
| download | android_external_libxml2-cm-13.0.tar.gz android_external_libxml2-cm-13.0.tar.bz2 android_external_libxml2-cm-13.0.zip | |
RESTRICT AUTOMERGE: Update libxml2 to 2.9.8HEADreplicant-6.0-0004-transitionreplicant-6.0-0004-rc6replicant-6.0-0004-rc5-transitionreplicant-6.0-0004-rc5replicant-6.0-0004-rc4replicant-6.0-0004-rc3replicant-6.0-0004-rc2replicant-6.0-0004cm-14.1cm-13.0
Merge to pi-dev and restore Android.mk
Bug: 79662501
Bug: 36809766
Bug: 36810305
Bug: 62151041
Test: manually verify functionality for regression
Change-Id: Ife351c91c932eb92992656f8ea5c08724a220306
(cherry picked from commit 4e91cfdbb1a8624e5cd5a850d6e17da11d1e34a8)
Diffstat (limited to 'parserInternals.c')
| -rw-r--r-- | parserInternals.c | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/parserInternals.c b/parserInternals.c index bfc778ac..8c0cd57a 100644 --- a/parserInternals.c +++ b/parserInternals.c @@ -10,7 +10,7 @@ #define IN_LIBXML #include "libxml.h" -#if defined(WIN32) && !defined (__CYGWIN__) +#if defined(_WIN32) && !defined (__CYGWIN__) #define XML_DIR_SEP '\\' #else #define XML_DIR_SEP '/' @@ -32,7 +32,7 @@ #ifdef HAVE_UNISTD_H #include <unistd.h> #endif -#ifdef HAVE_ZLIB_H +#ifdef LIBXML_ZLIB_ENABLED #include <zlib.h> #endif @@ -435,8 +435,6 @@ xmlNextChar(xmlParserCtxtPtr ctxt) if ((*ctxt->input->cur == 0) && (xmlParserInputGrow(ctxt->input, INPUT_CHUNK) <= 0)) { - if ((ctxt->instate != XML_PARSER_COMMENT)) - xmlPopInput(ctxt); return; } @@ -470,8 +468,8 @@ xmlNextChar(xmlParserCtxtPtr ctxt) c = *cur; if (c & 0x80) { - if (c == 0xC0) - goto encoding_error; + if (c == 0xC0) + goto encoding_error; if (cur[1] == 0) { xmlParserInputGrow(ctxt->input, INPUT_CHUNK); cur = ctxt->input->cur; @@ -523,8 +521,6 @@ xmlNextChar(xmlParserCtxtPtr ctxt) ctxt->input->cur++; ctxt->nbChars++; - if (*ctxt->input->cur == 0) - xmlParserInputGrow(ctxt->input, INPUT_CHUNK); } else { /* * Assume it's a fixed length encoding (1) with @@ -538,14 +534,9 @@ xmlNextChar(xmlParserCtxtPtr ctxt) ctxt->input->col++; ctxt->input->cur++; ctxt->nbChars++; - if (*ctxt->input->cur == 0) - xmlParserInputGrow(ctxt->input, INPUT_CHUNK); } - if ((*ctxt->input->cur == '%') && (!ctxt->html)) - xmlParserHandlePEReference(ctxt); - if ((*ctxt->input->cur == 0) && - (xmlParserInputGrow(ctxt->input, INPUT_CHUNK) <= 0)) - xmlPopInput(ctxt); + if (*ctxt->input->cur == 0) + xmlParserInputGrow(ctxt->input, INPUT_CHUNK); return; encoding_error: /* @@ -1101,8 +1092,15 @@ xmlSwitchEncoding(xmlParserCtxtPtr ctxt, xmlCharEncoding enc) break; } } - if (handler == NULL) + /* + * TODO: We could recover from errors in external entites if we + * didn't stop the parser. But most callers of this function don't + * check the return value. + */ + if (handler == NULL) { + xmlStopParser(ctxt); return(-1); + } ctxt->charset = XML_CHAR_ENCODING_UTF8; ret = xmlSwitchToEncodingInt(ctxt, handler, len); if ((ret < 0) || (ctxt->errNo == XML_I18N_CONV_FAILED)) { @@ -1216,7 +1214,7 @@ xmlSwitchInputEncodingInt(xmlParserCtxtPtr ctxt, xmlParserInputPtr input, /* * convert as much as possible of the buffer */ - nbchars = xmlCharEncInput(input->buf, 1); + nbchars = xmlCharEncInput(input->buf, 0); } else { /* * convert just enough to get @@ -1226,6 +1224,7 @@ xmlSwitchInputEncodingInt(xmlParserCtxtPtr ctxt, xmlParserInputPtr input, */ nbchars = xmlCharEncFirstLineInput(input->buf, len); } + xmlBufResetInput(input->buf->buffer, input); if (nbchars < 0) { xmlErrInternal(ctxt, "switching encoding: encoder error\n", @@ -1233,7 +1232,6 @@ xmlSwitchInputEncodingInt(xmlParserCtxtPtr ctxt, xmlParserInputPtr input, return (-1); } input->buf->rawconsumed += use - xmlBufUse(input->buf->raw); - xmlBufResetInput(input->buf->buffer, input); } return (0); } else if (input->length == 0) { @@ -1797,7 +1795,7 @@ xmlFreeParserCtxt(xmlParserCtxtPtr ctxt) if (ctxt->pushTab != NULL) xmlFree(ctxt->pushTab); if (ctxt->attallocs != NULL) xmlFree(ctxt->attallocs); if (ctxt->attsDefault != NULL) - xmlHashFree(ctxt->attsDefault, (xmlHashDeallocator) xmlFree); + xmlHashFree(ctxt->attsDefault, xmlHashDefaultDeallocator); if (ctxt->attsSpecial != NULL) xmlHashFree(ctxt->attsSpecial, NULL); if (ctxt->freeElems != NULL) { |
