[libxml2/2.9] Fix parsing of subtracted regex character classes
- From: Nick Wellnhofer <nwellnhof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libxml2/2.9] Fix parsing of subtracted regex character classes
- Date: Mon, 2 May 2022 11:46:13 +0000 (UTC)
commit c913f14c87e16dc964458a810fe2196bbdd5e642
Author: Nick Wellnhofer <wellnhofer aevum de>
Date: Sat Apr 23 19:19:33 2022 +0200
Fix parsing of subtracted regex character classes
Fixes #370.
result/regexp/issue370 | 3 +++
test/regexp/issue370 | 3 +++
xmlregexp.c | 2 +-
3 files changed, 7 insertions(+), 1 deletion(-)
---
diff --git a/result/regexp/issue370 b/result/regexp/issue370
new file mode 100644
index 00000000..42a74ec2
--- /dev/null
+++ b/result/regexp/issue370
@@ -0,0 +1,3 @@
+Regexp: [A-Za-[G]]
+G: Fail
+a: Ok
diff --git a/test/regexp/issue370 b/test/regexp/issue370
new file mode 100644
index 00000000..626b38e0
--- /dev/null
+++ b/test/regexp/issue370
@@ -0,0 +1,3 @@
+=>[A-Za-[G]]
+G
+a
diff --git a/xmlregexp.c b/xmlregexp.c
index 5816aa82..657912e0 100644
--- a/xmlregexp.c
+++ b/xmlregexp.c
@@ -5108,7 +5108,7 @@ xmlFAParseCharRange(xmlRegParserCtxtPtr ctxt) {
}
NEXTL(len);
cur = CUR;
- if ((cur != '-') || (NXT(1) == ']')) {
+ if ((cur != '-') || (NXT(1) == '[') || (NXT(1) == ']')) {
xmlRegAtomAddRange(ctxt, ctxt->atom, ctxt->neg,
XML_REGEXP_CHARVAL, start, end, NULL);
return;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]