diff options
author | drh <drh@noemail.net> | 2013-01-18 03:35:14 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2013-01-18 03:35:14 +0000 |
commit | b064dc33bc2fb2163a7a77cbfd830734e9f091ae (patch) | |
tree | bd86f9190a8f50f470edd262074e1492d428bce7 /src/test_regexp.c | |
parent | f218ee2dd407c92cd45085b795e8fd9bf449d009 (diff) | |
download | sqlite-b064dc33bc2fb2163a7a77cbfd830734e9f091ae.tar.gz sqlite-b064dc33bc2fb2163a7a77cbfd830734e9f091ae.zip |
The \xXX escape in the test_regexp.c must be followed by exactly two hex
digits.
FossilOrigin-Name: 82957495aa0729468a020c2a0a45ed60019b6e07
Diffstat (limited to 'src/test_regexp.c')
-rw-r--r-- | src/test_regexp.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/test_regexp.c b/src/test_regexp.c index c0361f17d..600043e9c 100644 --- a/src/test_regexp.c +++ b/src/test_regexp.c @@ -26,7 +26,7 @@ ** \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 @@ -387,9 +387,8 @@ static unsigned re_esc_char(ReCompiled *p){ char c; if( p->sIn.i>=p->sIn.mx ) return 0; c = p->sIn.z[p->sIn.i]; - if( c=='u' && p->sIn.i+5<p->sIn.mx ){ + if( c=='u' && p->sIn.i+4<p->sIn.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) @@ -399,11 +398,12 @@ static unsigned re_esc_char(ReCompiled *p){ return v; } } - if( c=='x' ){ - v = 0; - for(i=1; p->sIn.i<p->sIn.mx && re_hex(p->sIn.z[p->sIn.i+i], &v); i++){} - if( i>1 ){ - p->sIn.i += i; + if( c=='x' && p->sIn.i+2<p->sIn.mx ){ + const unsigned char *zIn = p->sIn.z + p->sIn.i; + if( re_hex(zIn[1],&v) + && re_hex(zIn[2],&v) + ){ + p->sIn.i += 3; return v; } } |