diff options
author | William M. Brack <wbrack@src.gnome.org> | 2007-03-21 13:16:33 +0000 |
---|---|---|
committer | William M. Brack <wbrack@src.gnome.org> | 2007-03-21 13:16:33 +0000 |
commit | a9cbf28361410926c82ae47a2c9d1a22795976c1 (patch) | |
tree | bed67393b5abe5a9e58e9d883fc7245b7d3536a9 /xmlregexp.c | |
parent | e978ae25ca37d1acba89b1e22b0948651f19f8af (diff) | |
download | android_external_libxml2-a9cbf28361410926c82ae47a2c9d1a22795976c1.tar.gz android_external_libxml2-a9cbf28361410926c82ae47a2c9d1a22795976c1.tar.bz2 android_external_libxml2-a9cbf28361410926c82ae47a2c9d1a22795976c1.zip |
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
Diffstat (limited to 'xmlregexp.c')
-rw-r--r-- | xmlregexp.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/xmlregexp.c b/xmlregexp.c index fbd0e9f3..784798d7 100644 --- a/xmlregexp.c +++ b/xmlregexp.c @@ -54,6 +54,11 @@ #define CUR_SCHAR(s, l) xmlStringCurrentChar(NULL, s, &l) #define NEXTL(l) ctxt->cur += l; #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: @@ -4853,10 +4858,15 @@ xmlFAParseCharRange(xmlRegParserCtxtPtr ctxt) { ERROR("Expecting a char range"); return; } - NEXTL(len); - if (start == '-') { + /* + * 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); return; } + NEXTL(len); cur = CUR; if ((cur != '-') || (NXT(1) == ']')) { xmlRegAtomAddRange(ctxt, ctxt->atom, ctxt->neg, |