mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-07-30 22:43:14 +03:00
fixed problem with 0x2d in Char Range (bug #420596) added regression test
* xmlregexp.c: fixed problem with 0x2d in Char Range (bug #420596) * test/regexp/bug420596, result/regexp/bug420596: added regression test for this svn path=/trunk/; revision=3594
This commit is contained in:
@ -1,3 +1,9 @@
|
|||||||
|
Wed Mar 21 21:20:48 HKT 2007 William Brack <wbrack@mmm.com.hk>
|
||||||
|
|
||||||
|
* xmlregexp.c: fixed problem with 0x2d in Char Range (bug #420596)
|
||||||
|
* test/regexp/bug420596, result/regexp/bug420596: added regression
|
||||||
|
test for this
|
||||||
|
|
||||||
Wed Mar 21 14:23:08 HKT 2007 William Brack <wbrack@mmm.com.hk>
|
Wed Mar 21 14:23:08 HKT 2007 William Brack <wbrack@mmm.com.hk>
|
||||||
|
|
||||||
* HTMLparser.c: fixed memory access error on parsing of meta data
|
* HTMLparser.c: fixed memory access error on parsing of meta data
|
||||||
|
10
result/regexp/bug420596
Normal file
10
result/regexp/bug420596
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
Regexp: (\+|-)(0[0-9]|1[0-1])
|
||||||
|
+01: Ok
|
||||||
|
-01: Ok
|
||||||
|
+10: Ok
|
||||||
|
-10: Ok
|
||||||
|
Regexp: [+-](0[0-9]|1[0-1])
|
||||||
|
+01: Ok
|
||||||
|
-01: Ok
|
||||||
|
+10: Ok
|
||||||
|
-10: Ok
|
10
test/regexp/bug420596
Normal file
10
test/regexp/bug420596
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
=>(\+|-)(0[0-9]|1[0-1])
|
||||||
|
+01
|
||||||
|
-01
|
||||||
|
+10
|
||||||
|
-10
|
||||||
|
=>[+-](0[0-9]|1[0-1])
|
||||||
|
+01
|
||||||
|
-01
|
||||||
|
+10
|
||||||
|
-10
|
12
xmlregexp.c
12
xmlregexp.c
@ -54,6 +54,11 @@
|
|||||||
#define CUR_SCHAR(s, l) xmlStringCurrentChar(NULL, s, &l)
|
#define CUR_SCHAR(s, l) xmlStringCurrentChar(NULL, s, &l)
|
||||||
#define NEXTL(l) ctxt->cur += l;
|
#define NEXTL(l) ctxt->cur += l;
|
||||||
#define XML_REG_STRING_SEPARATOR '|'
|
#define XML_REG_STRING_SEPARATOR '|'
|
||||||
|
/*
|
||||||
|
* Need PREV to check on a '-' within a Character Group. May only be used
|
||||||
|
* when it's guaranteed that cur is not at the beginning of ctxt->string!
|
||||||
|
*/
|
||||||
|
#define PREV (ctxt->cur[-1])
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO:
|
* TODO:
|
||||||
@ -4853,10 +4858,15 @@ xmlFAParseCharRange(xmlRegParserCtxtPtr ctxt) {
|
|||||||
ERROR("Expecting a char range");
|
ERROR("Expecting a char range");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
* Since we are "inside" a range, we can assume ctxt->cur is past
|
||||||
|
* the start of ctxt->string, and PREV should be safe
|
||||||
|
*/
|
||||||
|
if ((start == '-') && (NXT(1) != ']') && (PREV != '[') && (PREV != '^')) {
|
||||||
NEXTL(len);
|
NEXTL(len);
|
||||||
if (start == '-') {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
NEXTL(len);
|
||||||
cur = CUR;
|
cur = CUR;
|
||||||
if ((cur != '-') || (NXT(1) == ']')) {
|
if ((cur != '-') || (NXT(1) == ']')) {
|
||||||
xmlRegAtomAddRange(ctxt, ctxt->atom, ctxt->neg,
|
xmlRegAtomAddRange(ctxt, ctxt->atom, ctxt->neg,
|
||||||
|
Reference in New Issue
Block a user