1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2024-10-26 12:25:09 +03:00

Fix parsing of subtracted regex character classes

Fixes #370.
This commit is contained in:
Nick Wellnhofer 2022-04-23 19:19:33 +02:00
parent d9e1198c61
commit 145170125a
3 changed files with 7 additions and 1 deletions

3
result/regexp/issue370 Normal file
View File

@ -0,0 +1,3 @@
Regexp: [A-Za-[G]]
G: Fail
a: Ok

3
test/regexp/issue370 Normal file
View File

@ -0,0 +1,3 @@
=>[A-Za-[G]]
G
a

View File

@ -5166,7 +5166,7 @@ xmlFAParseCharRange(xmlRegParserCtxtPtr ctxt) {
} }
NEXTL(len); NEXTL(len);
cur = CUR; cur = CUR;
if ((cur != '-') || (NXT(1) == ']')) { if ((cur != '-') || (NXT(1) == '[') || (NXT(1) == ']')) {
xmlRegAtomAddRange(ctxt, ctxt->atom, ctxt->neg, xmlRegAtomAddRange(ctxt, ctxt->atom, ctxt->neg,
XML_REGEXP_CHARVAL, start, end, NULL); XML_REGEXP_CHARVAL, start, end, NULL);
return; return;