aboutsummaryrefslogtreecommitdiff
path: root/ext/misc/regexp.c
diff options
context:
space:
mode:
authordrh <>2021-06-04 15:56:43 +0000
committerdrh <>2021-06-04 15:56:43 +0000
commit9718bca77fd2526d3261af9a454b2c259f0fdc95 (patch)
tree3dcaa52c371b1de5a7274f3a14090a386023514d /ext/misc/regexp.c
parent19e4eefbca892a68a74407cfe40fb8d0f8435a6d (diff)
downloadsqlite-9718bca77fd2526d3261af9a454b2c259f0fdc95.tar.gz
sqlite-9718bca77fd2526d3261af9a454b2c259f0fdc95.zip
Fix more cases in the regexp extension where the 0x00 terminator at the end
of the input string is being pattern matched. [forum/forumpost/9104f0d9e7|Forum post 9104f0d9e7]. FossilOrigin-Name: 569e00d4acd426667990d675ca5da48a1859ac84af2412464ecd29c7c5da828c
Diffstat (limited to 'ext/misc/regexp.c')
-rw-r--r--ext/misc/regexp.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/ext/misc/regexp.c b/ext/misc/regexp.c
index 09ac9c502..47103d710 100644
--- a/ext/misc/regexp.c
+++ b/ext/misc/regexp.c
@@ -256,7 +256,7 @@ static int re_match(ReCompiled *pRe, const unsigned char *zIn, int nIn){
break;
}
case RE_OP_NOTWORD: {
- if( !re_word_char(c) ) re_add_state(pNext, x+1);
+ if( !re_word_char(c) && c!=0 ) re_add_state(pNext, x+1);
break;
}
case RE_OP_DIGIT: {
@@ -264,7 +264,7 @@ static int re_match(ReCompiled *pRe, const unsigned char *zIn, int nIn){
break;
}
case RE_OP_NOTDIGIT: {
- if( !re_digit_char(c) ) re_add_state(pNext, x+1);
+ if( !re_digit_char(c) && c!=0 ) re_add_state(pNext, x+1);
break;
}
case RE_OP_SPACE: {
@@ -272,7 +272,7 @@ static int re_match(ReCompiled *pRe, const unsigned char *zIn, int nIn){
break;
}
case RE_OP_NOTSPACE: {
- if( !re_space_char(c) ) re_add_state(pNext, x+1);
+ if( !re_space_char(c) && c!=0 ) re_add_state(pNext, x+1);
break;
}
case RE_OP_BOUNDARY: {
@@ -297,8 +297,11 @@ static int re_match(ReCompiled *pRe, const unsigned char *zIn, int nIn){
rc = 1;
goto re_match_end;
}
- case RE_OP_CC_INC:
case RE_OP_CC_EXC: {
+ if( c==0 ) break;
+ /* fall-through */
+ }
+ case RE_OP_CC_INC: {
int j = 1;
int n = pRe->aArg[x];
int hit = 0;