aboutsummaryrefslogtreecommitdiff
path: root/src/wherecode.c
diff options
context:
space:
mode:
authordrh <>2022-04-18 10:26:50 +0000
committerdrh <>2022-04-18 10:26:50 +0000
commitd875c7eefec1d7e6192948f87c8b34ce98b0ca45 (patch)
treef6547c17bf6ed68cf0720cdfa3df91ade12ea725 /src/wherecode.c
parentd973268ccfc5c545faa346ad6e6e236a936f6ef2 (diff)
downloadsqlite-d875c7eefec1d7e6192948f87c8b34ce98b0ca45.tar.gz
sqlite-d875c7eefec1d7e6192948f87c8b34ce98b0ca45.zip
Do not allow an empty table bypass to jump outside of a right-join body
subroutine. FossilOrigin-Name: 1549dcd2353903b70abadd428eeef971ab940df04fb05a6b83b04ee30932db6d
Diffstat (limited to 'src/wherecode.c')
-rw-r--r--src/wherecode.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/wherecode.c b/src/wherecode.c
index f08a4c280..e4a7b449f 100644
--- a/src/wherecode.c
+++ b/src/wherecode.c
@@ -1516,7 +1516,10 @@ Bitmask sqlite3WhereCodeOneLoopStart(
/* Compute a safe address to jump to if we discover that the table for
** this loop is empty and can never contribute content. */
- for(j=iLevel; j>0 && pWInfo->a[j].iLeftJoin==0; j--){}
+ for(j=iLevel; j>0; j--){
+ if( pWInfo->a[j].iLeftJoin ) break;
+ if( pWInfo->a[j].pRJ ) break;
+ }
addrHalt = pWInfo->a[j].addrBrk;
/* Special case of a FROM clause subquery implemented as a co-routine */