← Back to team overview

zorba-coders team mailing list archive

[Merge] lp:~paul-lucas/zorba/bug-946986 into lp:zorba

 

Paul J. Lucas has proposed merging lp:~paul-lucas/zorba/bug-946986 into lp:zorba.

Requested reviews:
  Chris Hillery (ceejatec)
  Paul J. Lucas (paul-lucas)
Related bugs:
  Bug #946986 in Zorba: "Unbalanced ')' in regex seg faults"
  https://bugs.launchpad.net/zorba/+bug/946986

For more details, see:
https://code.launchpad.net/~paul-lucas/zorba/bug-946986/+merge/102612

Added extra check for ')' without '('.
-- 
https://code.launchpad.net/~paul-lucas/zorba/bug-946986/+merge/102612
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'src/diagnostics/diagnostic_en.xml'
--- src/diagnostics/diagnostic_en.xml	2012-04-18 11:34:17 +0000
+++ src/diagnostics/diagnostic_en.xml	2012-04-19 01:44:20 +0000
@@ -3382,7 +3382,7 @@
     </entry>
 
     <entry key="UnbalancedChar_3" if="!defined(ZORBA_NO_ICU)">
-      <value>missing '$3'</value>
+      <value>unbalanced '$3'</value>
     </entry>
 
     <entry key="UnescapedChar_3" if="!defined(ZORBA_NO_ICU)">

=== modified file 'src/diagnostics/pregenerated/dict_en.cpp'
--- src/diagnostics/pregenerated/dict_en.cpp	2012-04-18 11:34:17 +0000
+++ src/diagnostics/pregenerated/dict_en.cpp	2012-04-19 01:44:20 +0000
@@ -748,7 +748,7 @@
 #endif
   { "~UnaryArithOp", "unary arithmetic operator" },
 #if !defined(ZORBA_NO_ICU)
-  { "~UnbalancedChar_3", "missing '$3'" },
+  { "~UnbalancedChar_3", "unbalanced '$3'" },
 #endif
 #if !defined(ZORBA_NO_ICU)
   { "~UnescapedChar_3", "character '$3' must be escaped here" },

=== modified file 'src/util/regex.cpp'
--- src/util/regex.cpp	2012-04-16 20:56:43 +0000
+++ src/util/regex.cpp	2012-04-19 01:44:20 +0000
@@ -238,7 +238,7 @@
           if ( q_flag )
             *icu_re += '\\';
           else {
-            if ( !open_cap_subs )
+            if ( !open_cap_subs || cur_cap_sub == 0 )
               throw INVALID_RE_EXCEPTION( xq_re, ZED( UnbalancedChar_3 ), ')' );
             cap_sub[ --cur_cap_sub ] = false;
           }

=== added file 'test/rbkt/Queries/zorba/string/Regex/regex-FORX0002-1.spec'
--- test/rbkt/Queries/zorba/string/Regex/regex-FORX0002-1.spec	1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/string/Regex/regex-FORX0002-1.spec	2012-04-19 01:44:20 +0000
@@ -0,0 +1,1 @@
+Error: http://www.w3.org/2005/xqt-errors:FORX0002

=== added file 'test/rbkt/Queries/zorba/string/Regex/regex-FORX0002-1.xq'
--- test/rbkt/Queries/zorba/string/Regex/regex-FORX0002-1.xq	1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/string/Regex/regex-FORX0002-1.xq	2012-04-19 01:44:20 +0000
@@ -0,0 +1,1 @@
+matches( 'qwerty', '(a))' )

=== added file 'test/rbkt/Queries/zorba/string/Regex/regex-FORX0002-2.spec'
--- test/rbkt/Queries/zorba/string/Regex/regex-FORX0002-2.spec	1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/string/Regex/regex-FORX0002-2.spec	2012-04-19 01:44:20 +0000
@@ -0,0 +1,1 @@
+Error: http://www.w3.org/2005/xqt-errors:FORX0002

=== added file 'test/rbkt/Queries/zorba/string/Regex/regex-FORX0002-2.xq'
--- test/rbkt/Queries/zorba/string/Regex/regex-FORX0002-2.xq	1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/string/Regex/regex-FORX0002-2.xq	2012-04-19 01:44:20 +0000
@@ -0,0 +1,1 @@
+matches( 'qwerty', 'ab|(d))' )


Follow ups