mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2024-10-26 12:25:09 +03:00
Fix caret in regexp character group
Apply Per Hedeland's patch from https://bugzilla.gnome.org/show_bug.cgi?id=779751 Fixes #188.
This commit is contained in:
parent
8a85263f13
commit
7d6837ba0e
19
xmlregexp.c
19
xmlregexp.c
@ -5155,7 +5155,7 @@ xmlFAParsePosCharGroup(xmlRegParserCtxtPtr ctxt) {
|
||||
} else {
|
||||
xmlFAParseCharRange(ctxt);
|
||||
}
|
||||
} while ((CUR != ']') && (CUR != '^') && (CUR != '-') &&
|
||||
} while ((CUR != ']') && (CUR != '-') &&
|
||||
(CUR != 0) && (ctxt->error == 0));
|
||||
}
|
||||
|
||||
@ -5170,34 +5170,31 @@ xmlFAParsePosCharGroup(xmlRegParserCtxtPtr ctxt) {
|
||||
*/
|
||||
static void
|
||||
xmlFAParseCharGroup(xmlRegParserCtxtPtr ctxt) {
|
||||
int n = ctxt->neg;
|
||||
while ((CUR != ']') && (ctxt->error == 0)) {
|
||||
if (CUR == '^') {
|
||||
int neg = ctxt->neg;
|
||||
|
||||
if (CUR == '^') {
|
||||
NEXT;
|
||||
ctxt->neg = !ctxt->neg;
|
||||
xmlFAParsePosCharGroup(ctxt);
|
||||
ctxt->neg = neg;
|
||||
} else if ((CUR == '-') && (NXT(1) == '[')) {
|
||||
int neg = ctxt->neg;
|
||||
ctxt->neg = 2;
|
||||
}
|
||||
while ((CUR != ']') && (ctxt->error == 0)) {
|
||||
if ((CUR == '-') && (NXT(1) == '[')) {
|
||||
NEXT; /* eat the '-' */
|
||||
NEXT; /* eat the '[' */
|
||||
ctxt->neg = 2;
|
||||
xmlFAParseCharGroup(ctxt);
|
||||
ctxt->neg = neg;
|
||||
if (CUR == ']') {
|
||||
NEXT;
|
||||
} else {
|
||||
ERROR("charClassExpr: ']' expected");
|
||||
break;
|
||||
}
|
||||
ctxt->neg = neg;
|
||||
break;
|
||||
} else if (CUR != ']') {
|
||||
} else {
|
||||
xmlFAParsePosCharGroup(ctxt);
|
||||
}
|
||||
}
|
||||
ctxt->neg = n;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user