Index: src/regexp.c ================================================================== --- src/regexp.c +++ src/regexp.c @@ -32,11 +32,11 @@ ** X$ X occurring at the end of the string ** . Match any single character ** \c Character c where c is one of \{}()[]|*+?. ** \c C-language escapes for c in afnrtv. ex: \t or \n ** \uXXXX Where XXXX is exactly 4 hex digits, unicode value XXXX -** \xXXX Where XXX is any number of hex digits, unicode value XXX +** \xXX Where XX is exactly 2 hex digits, unicode value XX ** [abc] Any single character from the set abc ** [^abc] Any single character not in the set abc ** [a-z] Any single character in the range a-z ** [^a-z] Any single character not in the range a-z ** \b Word boundary @@ -381,22 +381,21 @@ *pV = (*pV)*16 + (c & 0xff); return 1; } /* A backslash character has been seen, read the next character and -** return its intepretation. +** return its interpretation. */ static unsigned re_esc_char(ReCompiled *p){ static const char zEsc[] = "afnrtv\\()*.+?[$^{|}]"; static const char zTrans[] = "\a\f\n\r\t\v"; int i, v = 0; char c; if( p->sIn.i>=p->sIn.mx ) return 0; c = p->sIn.z[p->sIn.i]; - if( c=='u' && p->sIn.i+5sIn.mx ){ + if( c=='u' && p->sIn.i+4sIn.mx ){ const unsigned char *zIn = p->sIn.z + p->sIn.i; - v = 0; if( re_hex(zIn[1],&v) && re_hex(zIn[2],&v) && re_hex(zIn[3],&v) && re_hex(zIn[4],&v) ){ @@ -403,15 +402,16 @@ p->sIn.i += 5; return v; } } if( c=='x' ){ - v = 0; - for(i=1; p->sIn.isIn.mx && re_hex(p->sIn.z[p->sIn.i+i], &v); i++){} - if( i>1 ){ - p->sIn.i += i; - return v; + const unsigned char *zIn = p->sIn.z + p->sIn.i; + if( p->sIn.i+2sIn.mx ){ + if( re_hex(zIn[1],&v) && re_hex(zIn[2],&v) ){ + p->sIn.i += 3; + return v; + } } } for(i=0; zEsc[i] && zEsc[i]!=c; i++){} if( zEsc[i] ){ if( i<6 ) c = zTrans[i];