/ Check-in [82957495]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:The \xXX escape in the test_regexp.c must be followed by exactly two hex digits.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 82957495aa0729468a020c2a0a45ed60019b6e07
User & Date: drh 2013-01-18 03:35:14
Context
2013-01-20
00:18
Fix a typo in a comment in the test_regexp.c test file. check-in: 68346af7 user: drh tags: trunk
2013-01-18
03:35
The \xXX escape in the test_regexp.c must be followed by exactly two hex digits. check-in: 82957495 user: drh tags: trunk
2013-01-17
17:20
Enhance the query planner to exploit transitivity of join constraints. check-in: 38852f15 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/test_regexp.c.

    22     22   **     X|Y     X or Y
    23     23   **     ^X      X occurring at the beginning of the string
    24     24   **     X$      X occurring at the end of the string
    25     25   **     .       Match any single character
    26     26   **     \c      Character c where c is one of \{}()[]|*+?.
    27     27   **     \c      C-language escapes for c in afnrtv.  ex: \t or \n
    28     28   **     \uXXXX  Where XXXX is exactly 4 hex digits, unicode value XXXX
    29         -**     \xXXX   Where XXX is any number of hex digits, unicode value XXX
           29  +**     \xXX    Where XX is exactly 2 hex digits, unicode value XX
    30     30   **     [abc]   Any single character from the set abc
    31     31   **     [^abc]  Any single character not in the set abc
    32     32   **     [a-z]   Any single character in the range a-z
    33     33   **     [^a-z]  Any single character not in the range a-z
    34     34   **     \b      Word boundary
    35     35   **     \w      Word character.  [A-Za-z0-9_]
    36     36   **     \W      Non-word character
................................................................................
   383    383   static unsigned re_esc_char(ReCompiled *p){
   384    384     static const char zEsc[] = "afnrtv\\()*.+?[$^{|}]";
   385    385     static const char zTrans[] = "\a\f\n\r\t\v";
   386    386     int i, v = 0;
   387    387     char c;
   388    388     if( p->sIn.i>=p->sIn.mx ) return 0;
   389    389     c = p->sIn.z[p->sIn.i];
   390         -  if( c=='u' && p->sIn.i+5<p->sIn.mx ){
          390  +  if( c=='u' && p->sIn.i+4<p->sIn.mx ){
   391    391       const unsigned char *zIn = p->sIn.z + p->sIn.i;
   392         -    v = 0;
   393    392       if( re_hex(zIn[1],&v)
   394    393        && re_hex(zIn[2],&v)
   395    394        && re_hex(zIn[3],&v)
   396    395        && re_hex(zIn[4],&v)
   397    396       ){
   398    397         p->sIn.i += 5;
   399    398         return v;
   400    399       }
   401    400     }
   402         -  if( c=='x' ){
   403         -    v = 0;
   404         -    for(i=1; p->sIn.i<p->sIn.mx && re_hex(p->sIn.z[p->sIn.i+i], &v); i++){}
   405         -    if( i>1 ){
   406         -      p->sIn.i += i;
          401  +  if( c=='x' && p->sIn.i+2<p->sIn.mx ){
          402  +    const unsigned char *zIn = p->sIn.z + p->sIn.i;
          403  +    if( re_hex(zIn[1],&v)
          404  +     && re_hex(zIn[2],&v)
          405  +    ){
          406  +      p->sIn.i += 3;
   407    407         return v;
   408    408       }
   409    409     }
   410    410     for(i=0; zEsc[i] && zEsc[i]!=c; i++){}
   411    411     if( zEsc[i] ){
   412    412       if( i<6 ) c = zTrans[i];
   413    413       p->sIn.i++;

Changes to test/regexp1.test.

   193    193            'abc{4}x' REGEXP '^abc\{4\}x$',
   194    194            'abc|def' REGEXP '^abc\|def$'
   195    195   } {1 1 1 1 1 1 1 1 1 1 1 1}
   196    196   
   197    197   do_execsql_test regexp1-2.20 {
   198    198     SELECT 'abc$¢€xyz' REGEXP '^abc\u0024\u00a2\u20acxyz$',
   199    199            'abc$¢€xyz' REGEXP '^abc\u0024\u00A2\u20ACxyz$',
   200         -         'abc$¢€xyz' REGEXP '^abc\x24\xa2\x20acxyz$'
          200  +         'abc$¢€xyz' REGEXP '^abc\x24\xa2\u20acxyz$'
   201    201   } {1 1 1}
   202    202   do_execsql_test regexp1-2.21 {
   203    203     SELECT 'abc$¢€xyz' REGEXP '^abc[\u0024][\u00a2][\u20ac]xyz$',
   204    204            'abc$¢€xyz' REGEXP '^abc[\u0024\u00A2\u20AC]{3}xyz$',
   205         -         'abc$¢€xyz' REGEXP '^abc[\x24][\xa2\x20ac]+xyz$'
          205  +         'abc$¢€xyz' REGEXP '^abc[\x24][\xa2\u20ac]+xyz$'
   206    206   } {1 1 1}
   207    207   do_execsql_test regexp1-2.22 {
   208    208     SELECT 'abc$¢€xyz' REGEXP '^abc[^\u0025-X][^ -\u007f][^\u20ab]xyz$'
   209    209   } {1}
   210    210   
   211    211   finish_test