Paul J. Lucas has proposed merging lp:~paul-lucas/zorba/bug-855715 into
lp:zorba.
Requested reviews:
Paul J. Lucas (paul-lucas)
Matthias Brantner (matthias-brantner)
For more details, see:
https://code.launchpad.net/~paul-lucas/zorba/bug-855715/+merge/79768
Now checking for invalid regex escape sequences.
--
https://code.launchpad.net/~paul-lucas/zorba/bug-855715/+merge/79768
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'ChangeLog'
--- ChangeLog 2011-10-12 21:30:46 +
+++ ChangeLog 2011-10-19 05:12:24 +
@@ -52,6 +52,7 @@
* Added undo for node revalidation
* Fixed bug #872796 (validate-in-place can interfere with other update primitives)
* Fixed bug #872799 (validate-in-place can set incorrect types)
+ * Fixed bug #855715 (Invalid escaped characters in regex not caught)
version 2.0.1
=== modified file 'modules/com/zorba-xquery/www/modules/xqdoc2xhtml/index.xq'
--- modules/com/zorba-xquery/www/modules/xqdoc2xhtml/index.xq 2011-10-07 08:28:43 +
+++ modules/com/zorba-xquery/www/modules/xqdoc2xhtml/index.xq 2011-10-19 05:12:24 +
@@ -1364,7 +1364,7 @@
fn:concat(fn:substring-before($description,.),.) else
order by $name, $param-number
return
-let $type := replace(normalize-space(substring-after(substring-before($signature, function), declare)),\%,),
+let $type := replace(normalize-space(substring-after(substring-before($signature, function), declare)),%,),
$isExternal := ends-with($signature, external),
$paramsAndReturn := substring-after($signature,concat(':',$name)),
$external := if(ends-with($signature,external)) then external else
=== modified file 'modules/org/expath/ns/file.xq'
--- modules/org/expath/ns/file.xq 2011-10-17 11:49:38 +
+++ modules/org/expath/ns/file.xq 2011-10-19 05:12:24 +
@@ -624,7 +624,7 @@
declare function file:glob-to-regex(
$pattern as xs:string
) {
- let $pattern := fn:replace($pattern, '(\.|\[|\]|\\|\/|\||\-|\^|\$|\?|\*|\+|\{|\}|\(|\))','\\$1')
+ let $pattern := fn:replace($pattern, '(\.|\[|\]|\\|/|\||\-|\^|\$|\?|\*|\+|\{|\}|\(|\))','\\$1')
let $pattern := fn:replace($pattern, '\\\?', '.')
let $pattern := fn:replace($pattern, '\\\*', '.*')
return
=== modified file 'src/diagnostics/diagnostic_en.xml'
--- src/diagnostics/diagnostic_en.xml 2011-10-05 18:52:55 +
+++ src/diagnostics/diagnostic_en.xml 2011-10-19 05:12:24 +
@@ -2393,6 +2393,10 @@
valueinvalid library module/value
/entry
+entry key=BadRegexEscape_3
+ value$3: illegal escape character/value
+/entry
+
entry key=BadPath
valueinvalid path/value
/entry
=== modified file 'src/diagnostics/pregenerated/dict_en.cpp'
--- src/diagnostics/pregenerated/dict_en.cpp 2011-10-05 17:49:48 +
+++ src/diagnostics/pregenerated/dict_en.cpp 2011-10-19 05:12:24 +
@@ -424,6 +424,7 @@
{ ~BadIterator, invalid iterator },
{ ~BadLibraryModule, invalid library module },
{ ~BadPath, invalid path },
+ { ~BadRegexEscape_3, \$3\: illegal escape character },
{ ~BadStreamState, bad I/O stream state },
{ ~BadTokenInBraces_3, \$3\: illegal token within { } },
{ ~BadTraceStream, trace stream not retrievable using SerializationCallback },
=== modified file 'src/util/regex.cpp'
--- src/util/regex.cpp 2011-07-18 14:25:21 +
+++ src/util/regex.cpp 2011-10-19 05:12:24 +
@@ -128,33 +128,69 @@
case 'c': // NameChar
*icu_re += [ bs_c ];
continue;
-case 'C': // ^\c
+case 'C': // [^\c]
*icu_re += [^ bs_c ];
continue;
case 'i': // initial NameChar
*icu_re += [ bs_i ];
continue;
-case 'I': // ^\i
+case 'I': // [^\i]
*icu_re += [^ bs_i ];
continue;
-default:
- if ( ascii::is_digit( *xq_c ) ) {
-backref_no = *xq_c - '0';
-if ( !backref_no ) // \0 is illegal
- throw INVALID_RE_EXCEPTION( xq_re, ZED( BackRef0Illegal ) );
-if ( in_char_class ) {
- //
- // XQuery 3.0 FO 5.6.1: Within a character class expression,
- // \ followed by a digit is invalid.
- //
- throw INVALID_RE_EXCEPTION(
-xq_re, ZED( BackRefIllegalInCharClass )
- );
-}
-in_backref = true;
+case '0':
+case '1':
+case '2':
+case '3':
+case '4':
+case '5':
+case '6':
+case '7':
+case '8':
+case '9':
+ backref_no = *xq_c - '0';
+ if ( !backref_no ) // \0 is illegal
+throw INVALID_RE_EXCEPTION( xq_re, ZED( BackRef0Illegal ) );
+ if ( in_char_class ) {
+//
+// XQuery 3.0 FO 5.6.1: Within a character class expression,
+// \ followed by a digit is invalid.
+