diff options
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; } } |