Upgrade libxml2 to 1a360c1c2ec950f478d55b31722ecf78f5698e97
Also change upstream to github.
This change moves away from stable release. Because we need CMakeLists.txt. It is not in any release yet.
They are likely to release another stable version within this year. We can upgrade to that version when it is available.
Bug: 157157503
Change-Id: If6f245dbabe36a114563d209c8e100b7e3083f20
diff --git a/xpointer.c b/xpointer.c
index 6a41f07..39f4ac7 100644
--- a/xpointer.c
+++ b/xpointer.c
@@ -27,7 +27,7 @@
* be parsed beforehand instead of a progressive evaluation
* TODO: Access into entities references are not supported now ...
* need a start to be able to pop out of entities refs since
- * parent is the endity declaration, not the ref.
+ * parent is the entity declaration, not the ref.
*/
#include <string.h>
@@ -70,7 +70,7 @@
/**
* xmlXPtrErrMemory:
- * @extra: extra informations
+ * @extra: extra information
*
* Handle a redefinition of attribute error
*/
@@ -86,7 +86,7 @@
/**
* xmlXPtrErr:
* @ctxt: an XPTR evaluation context
- * @extra: extra informations
+ * @extra: extra information
*
* Handle a redefinition of attribute error
*/
@@ -1005,7 +1005,7 @@
/*
* To evaluate an xpointer scheme element (4.3) we need:
* context initialized to the root
- * context position initalized to 1
+ * context position initialized to 1
* context size initialized to 1
*/
ctxt->context->node = (xmlNodePtr)ctxt->context->doc;
@@ -1186,7 +1186,7 @@
static void
xmlXPtrEvalChildSeq(xmlXPathParserContextPtr ctxt, xmlChar *name) {
/*
- * XPointer don't allow by syntax to address in mutirooted trees
+ * XPointer don't allow by syntax to address in multirooted trees
* this might prove useful in some cases, warn about it.
*/
if ((name == NULL) && (CUR == '/') && (NXT(1) != '1')) {
@@ -1202,13 +1202,23 @@
}
while (CUR == '/') {
- int child = 0;
+ int child = 0, overflow = 0;
NEXT;
while ((CUR >= '0') && (CUR <= '9')) {
- child = child * 10 + (CUR - '0');
+ int d = CUR - '0';
+ if (child > INT_MAX / 10)
+ overflow = 1;
+ else
+ child *= 10;
+ if (child > INT_MAX - d)
+ overflow = 1;
+ else
+ child += d;
NEXT;
}
+ if (overflow)
+ child = 0;
xmlXPtrGetChildNo(ctxt, child);
}
}
@@ -1526,7 +1536,7 @@
case XML_ELEMENT_DECL:
case XML_ATTRIBUTE_DECL:
case XML_ENTITY_NODE:
- /* Do not copy DTD informations */
+ /* Do not copy DTD information */
break;
case XML_ENTITY_DECL:
TODO /* handle crossing entities -> stack needed */