aboutsummaryrefslogtreecommitdiffstats
path: root/xmlregexp.c
diff options
context:
space:
mode:
authorWilliam M. Brack <wbrack@src.gnome.org>2004-03-20 14:51:25 +0000
committerWilliam M. Brack <wbrack@src.gnome.org>2004-03-20 14:51:25 +0000
commit10f1ef4ce875d6affb467f33ab653cd8072e5888 (patch)
tree7f5cd229c3ee823b9e54152b4d77a6747ef7e963 /xmlregexp.c
parent236c8c09f0145a338fb383fb9bffffd09f33a981 (diff)
downloadandroid_external_libxml2-10f1ef4ce875d6affb467f33ab653cd8072e5888.tar.gz
android_external_libxml2-10f1ef4ce875d6affb467f33ab653cd8072e5888.tar.bz2
android_external_libxml2-10f1ef4ce875d6affb467f33ab653cd8072e5888.zip
enhanced the logic of parsing char groups to better handle initial or
* xmlregexp.c: enhanced the logic of parsing char groups to better handle initial or ending '-' (bug 135972)
Diffstat (limited to 'xmlregexp.c')
-rw-r--r--xmlregexp.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/xmlregexp.c b/xmlregexp.c
index 1706c740..057458b2 100644
--- a/xmlregexp.c
+++ b/xmlregexp.c
@@ -3572,7 +3572,7 @@ xmlFAParseCharRange(xmlRegParserCtxtPtr ctxt) {
return;
}
cur = CUR;
- if (cur != '-') {
+ if ((cur != '-') || (NXT(1) == ']')) {
xmlRegAtomAddRange(ctxt, ctxt->atom, ctxt->neg,
XML_REGEXP_CHARVAL, start, end, NULL);
return;
@@ -3650,15 +3650,11 @@ xmlFAParseCharGroup(xmlRegParserCtxtPtr ctxt) {
ctxt->neg = !ctxt->neg;
xmlFAParsePosCharGroup(ctxt);
ctxt->neg = neg;
- } else if (CUR == '-') {
+ } else if ((CUR == '-') && (NXT(1) == '[')) {
int neg = ctxt->neg;
- NEXT;
ctxt->neg = 2;
- if (CUR != '[') {
- ERROR("charClassExpr: '[' expected");
- break;
- }
- NEXT;
+ NEXT; /* eat the '-' */
+ NEXT; /* eat the '[' */
xmlFAParseCharGroup(ctxt);
if (CUR == ']') {
NEXT;