aboutsummaryrefslogtreecommitdiffstats
path: root/xmlregexp.c
diff options
context:
space:
mode:
authorakirilov <akirilov@google.com>2018-06-01 13:46:04 -0700
committersyphyr <syphyr@gmail.com>2018-09-06 04:08:09 +0200
commit126c3993d2ad55db2abfe80e3d671bf584e7b13b (patch)
treef4464c225863c997e3f99d9897131f9f28df76fe /xmlregexp.c
parent521b88fbb6d18312923f0df653d045384b500ffc (diff)
downloadandroid_external_libxml2-126c3993d2ad55db2abfe80e3d671bf584e7b13b.tar.gz
android_external_libxml2-126c3993d2ad55db2abfe80e3d671bf584e7b13b.tar.bz2
android_external_libxml2-126c3993d2ad55db2abfe80e3d671bf584e7b13b.zip
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 'xmlregexp.c')
-rw-r--r--xmlregexp.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/xmlregexp.c b/xmlregexp.c
index ca3b4f46..d255fbf0 100644
--- a/xmlregexp.c
+++ b/xmlregexp.c
@@ -2810,18 +2810,21 @@ xmlRegCheckCharacterRange(xmlRegAtomType type, int codepoint, int neg,
break;
case XML_REGEXP_NOTSPACE:
neg = !neg;
+ /* Falls through. */
case XML_REGEXP_ANYSPACE:
ret = ((codepoint == '\n') || (codepoint == '\r') ||
(codepoint == '\t') || (codepoint == ' '));
break;
case XML_REGEXP_NOTINITNAME:
neg = !neg;
+ /* Falls through. */
case XML_REGEXP_INITNAME:
ret = (IS_LETTER(codepoint) ||
(codepoint == '_') || (codepoint == ':'));
break;
case XML_REGEXP_NOTNAMECHAR:
neg = !neg;
+ /* Falls through. */
case XML_REGEXP_NAMECHAR:
ret = (IS_LETTER(codepoint) || IS_DIGIT(codepoint) ||
(codepoint == '.') || (codepoint == '-') ||
@@ -2830,11 +2833,13 @@ xmlRegCheckCharacterRange(xmlRegAtomType type, int codepoint, int neg,
break;
case XML_REGEXP_NOTDECIMAL:
neg = !neg;
+ /* Falls through. */
case XML_REGEXP_DECIMAL:
ret = xmlUCSIsCatNd(codepoint);
break;
case XML_REGEXP_REALCHAR:
neg = !neg;
+ /* Falls through. */
case XML_REGEXP_NOTREALCHAR:
ret = xmlUCSIsCatP(codepoint);
if (ret == 0)
@@ -4089,8 +4094,9 @@ rollback:
xmlFree(exec->errString);
exec->errString = xmlStrdup(value);
exec->errState = exec->state;
- memcpy(exec->errCounts, exec->counts,
- exec->comp->nbCounters * sizeof(int));
+ if (exec->comp->nbCounters)
+ memcpy(exec->errCounts, exec->counts,
+ exec->comp->nbCounters * sizeof(int));
}
/*
@@ -4880,7 +4886,8 @@ xmlFAParseCharClassEsc(xmlRegParserCtxtPtr ctxt) {
}
NEXT;
xmlFAParseCharProp(ctxt);
- ctxt->atom->neg = 1;
+ if (ctxt->atom != NULL)
+ ctxt->atom->neg = 1;
if (CUR != '}') {
ERROR("Expecting '}'");
return;
@@ -5051,7 +5058,7 @@ xmlFAParseCharRange(xmlRegParserCtxtPtr ctxt) {
return;
}
len = 1;
- } else if ((cur != 0x5B) && (cur != 0x5D)) {
+ } else if ((cur != '\0') && (cur != 0x5B) && (cur != 0x5D)) {
end = CUR_SCHAR(ctxt->cur, len);
} else {
ERROR("Expecting the end of a char range");