diff options
author | Xin Li <delphij@google.com> | 2016-07-26 14:22:54 -0700 |
---|---|---|
committer | Xin Li <delphij@google.com> | 2016-08-15 22:30:45 +0000 |
commit | a136fc2e5a8893a02b0912862d26a575fcbd641a (patch) | |
tree | 341dc6790424526b424173dc7bc5a1165db7de10 /xmlregexp.c | |
parent | edb5870767fed8712a9b77ef34097209b61ab2db (diff) | |
download | android_external_libxml2-a136fc2e5a8893a02b0912862d26a575fcbd641a.tar.gz android_external_libxml2-a136fc2e5a8893a02b0912862d26a575fcbd641a.tar.bz2 android_external_libxml2-a136fc2e5a8893a02b0912862d26a575fcbd641a.zip |
Merge remote-tracking branch 'goog/upstream-master' into mymerge
BUG: 29834751
Change-Id: I88fc1d4f86bcbd0ac0fe9acdbe764f3d738c5f32
(cherry picked from commit e3d78e1fe0669e9c7083a4de19f1e06171849b28)
Diffstat (limited to 'xmlregexp.c')
-rw-r--r-- | xmlregexp.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/xmlregexp.c b/xmlregexp.c index 3e912ab9..ca3b4f46 100644 --- a/xmlregexp.c +++ b/xmlregexp.c @@ -1544,6 +1544,7 @@ static int xmlFAGenerateTransitions(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr from, xmlRegStatePtr to, xmlRegAtomPtr atom) { xmlRegStatePtr end; + int nullable = 0; if (atom == NULL) { ERROR("genrate transition: atom == NULL"); @@ -1730,6 +1731,13 @@ xmlFAGenerateTransitions(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr from, if (xmlRegAtomPush(ctxt, atom) < 0) { return(-1); } + if ((atom->quant == XML_REGEXP_QUANT_RANGE) && + (atom->min == 0) && (atom->max > 0)) { + nullable = 1; + atom->min = 1; + if (atom->max == 1) + atom->quant = XML_REGEXP_QUANT_OPT; + } xmlRegStateAddTrans(ctxt, from, atom, to, -1, -1); ctxt->state = end; switch (atom->quant) { @@ -1747,11 +1755,8 @@ xmlFAGenerateTransitions(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr from, xmlRegStateAddTrans(ctxt, to, atom, to, -1, -1); break; case XML_REGEXP_QUANT_RANGE: -#if DV_test - if (atom->min == 0) { + if (nullable) xmlFAGenerateEpsilonTransition(ctxt, from, to); - } -#endif break; default: break; @@ -5052,11 +5057,12 @@ xmlFAParseCharRange(xmlRegParserCtxtPtr ctxt) { ERROR("Expecting the end of a char range"); return; } - NEXTL(len); + /* TODO check that the values are acceptable character ranges for XML */ if (end < start) { ERROR("End of range is before start of range"); } else { + NEXTL(len); xmlRegAtomAddRange(ctxt, ctxt->atom, ctxt->neg, XML_REGEXP_CHARVAL, start, end, NULL); } @@ -6345,7 +6351,7 @@ struct _xmlExpCtxt { /** * xmlExpNewCtxt: * @maxNodes: the maximum number of nodes - * @dict: optional dictionnary to use internally + * @dict: optional dictionary to use internally * * Creates a new context for manipulating expressions * @@ -7204,7 +7210,7 @@ xmlExpStringDerive(xmlExpCtxtPtr ctxt, xmlExpNodePtr exp, return(NULL); } /* - * check the string is in the dictionnary, if yes use an interned + * check the string is in the dictionary, if yes use an interned * copy, otherwise we know it's not an acceptable input */ input = xmlDictExists(ctxt->dict, str, len); |