1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-07-28 00:21:53 +03:00

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)
This commit is contained in:
William M. Brack
2004-03-20 14:51:25 +00:00
parent 236c8c09f0
commit 10f1ef4ce8
2 changed files with 9 additions and 8 deletions

View File

@ -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;