aboutsummaryrefslogtreecommitdiff
path: root/ext/misc/regexp.c
diff options
context:
space:
mode:
authordrh <>2023-05-12 15:45:34 +0000
committerdrh <>2023-05-12 15:45:34 +0000
commit4f3dc93978f36a219ffa042ec78c5851e92d22bf (patch)
tree21643ad499b4072375746f14d27dba25a7e2a6c7 /ext/misc/regexp.c
parentfb74019a143dae9d20ba408ac8da74818cea6776 (diff)
downloadsqlite-4f3dc93978f36a219ffa042ec78c5851e92d22bf.tar.gz
sqlite-4f3dc93978f36a219ffa042ec78c5851e92d22bf.zip
Make the regexp extension more robust against OOM errors during compilation
of the recognizer engine. [forum:/forumpost/f50aecd5e8|Forum post f50aecd5e8]. FossilOrigin-Name: 0772ddf56713d013cd1bd44f9c75977ca14f852e3a8f038b0a6b9814f6519d79
Diffstat (limited to 'ext/misc/regexp.c')
-rw-r--r--ext/misc/regexp.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/ext/misc/regexp.c b/ext/misc/regexp.c
index 5da80dd92..743c262e0 100644
--- a/ext/misc/regexp.c
+++ b/ext/misc/regexp.c
@@ -619,7 +619,7 @@ static const char *re_subcompile_string(ReCompiled *p){
if( rePeek(p)==']' ){ p->sIn.i++; break; }
}
if( c==0 ) return "unclosed '['";
- p->aArg[iFirst] = p->nState - iFirst;
+ if( p->nState>iFirst ) p->aArg[iFirst] = p->nState - iFirst;
break;
}
case '\\': {