From: drh <> Date: Sat, 23 Apr 2022 18:34:55 +0000 (+0000) Subject: Fix false-positives in sqlite3VdbeNoJumpsOutsideSubrtn(). All tests pass now. X-Git-Tag: version-3.39.0~198^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fheads%2Fright-join-subrtn-check;p=thirdparty%2Fsqlite.git Fix false-positives in sqlite3VdbeNoJumpsOutsideSubrtn(). All tests pass now. FossilOrigin-Name: 1300d978d5a072780e0f16722e42461dc983de9b4dfb2f5a7023c74c92ab9bc8 --- diff --git a/manifest b/manifest index 80f614183c..44068e70ea 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C For\sdebug\sbuilds,\sif\sthe\sRIGHT\sJOIN\sbody\ssubroutine\scontains\sa\sjump\sthat\nescapes\sthe\ssubroutine,\sthen\sabort\sthe\sprepared\sstatement\swith\sa\sdescriptive\nerror\sand\sSQLITE_INTERNAL.\s\sThis\sextra\ssanity\scheck\scauses\smany\stests\sto\nfail. -D 2022-04-23T18:04:31.226 +C Fix\sfalse-positives\sin\ssqlite3VdbeNoJumpsOutsideSubrtn().\s\sAll\stests\spass\snow. +D 2022-04-23T18:34:55.922 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -629,7 +629,7 @@ F src/vdbe.c 9527ab7f71c5b0291e5ed7727f213f4d7f6e0a82af019da5b365fd5a0f56bb96 F src/vdbe.h 07641758ca8b4f4c6d81ea667ea167c541e6ece21f5574da11e3d21ec37e2662 F src/vdbeInt.h ef43f7fdc5fde29fc3fd29c506c12830f366178fdb4edbbf0cbc3dfbd1278b5f F src/vdbeapi.c 354c893f1500cf524cc45c32879b9c68893a28b77e3442c24668d6afe4236217 -F src/vdbeaux.c 8bc10fd6c306ac7e86ea2419f7729886efc0957afa17597b551d5a20f862272e +F src/vdbeaux.c f406d8d8b461f260aeaa69d265c5d175ff0a9f84d6153c87975cdfbf9d681922 F src/vdbeblob.c 5e61ce31aca17db8fb60395407457a8c1c7fb471dde405e0cd675974611dcfcd F src/vdbemem.c 7189090b72baa025f945a1ac8c61ee420c645254476e8a191d555db76dfea5d4 F src/vdbesort.c 43756031ca7430f7aec3ef904824a7883c4ede783e51f280d99b9b65c0796e35 @@ -1951,11 +1951,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 9425d79cb407dedc259655625369e023d22a04ef7db606ea3eefe7e4d662be1a -R 8428b3472cd00a82f3a0cce7bac1b298 -T *branch * right-join-subrtn-check -T *sym-right-join-subrtn-check * -T -sym-trunk * +P 2c5bb2bff26cc70d8cac78ddd12d5ac37ab1472f5f88afbd975950a18ac2804d +R 1dad547c493f60bf8d226b9a1521fea3 U drh -Z cbfc5874b147218fb2a4bd50574bf5b9 +Z a750b57e12ed48042d97498102c6d29b # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 1d427477e5..e9696b34fa 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -2c5bb2bff26cc70d8cac78ddd12d5ac37ab1472f5f88afbd975950a18ac2804d \ No newline at end of file +1300d978d5a072780e0f16722e42461dc983de9b4dfb2f5a7023c74c92ab9bc8 \ No newline at end of file diff --git a/src/vdbeaux.c b/src/vdbeaux.c index 3569fa994c..9e702edcd5 100644 --- a/src/vdbeaux.c +++ b/src/vdbeaux.c @@ -892,8 +892,9 @@ static void resolveP2Values(Vdbe *p, int *pMaxFuncArgs){ ** through iLast are also acceptable as long as the jump destination is ** an OP_Return to iReturnAddr. ** -** A jump to an unresolved label is considered to be a jump outside of the -** subroutine. +** A jump to an unresolved label means that the jump destination will be +** beyond the current address. That is normally a jump to an early +** termination and is consider acceptable. ** ** This routine only runs during debug builds. The purpose is (of course) ** to detect invalid escapes out of a subroutine. The OP_Halt opcode @@ -921,20 +922,11 @@ void sqlite3VdbeNoJumpsOutsideSubrtn( if( (sqlite3OpcodeProperty[pOp->opcode] & OPFLG_JUMP)!=0 ){ int iDest = pOp->p2; /* Jump destination */ if( iDest==0 ) continue; + if( pOp->opcode==OP_Gosub ) continue; if( iDest<0 ){ int j = ADDR(iDest); assert( j>=0 ); if( j>=-pParse->nLabel || pParse->aLabel[j]<0 ){ - if( pErr==0 ){ - pErr = sqlite3_str_new(0); - }else{ - sqlite3_str_appendchar(pErr, 1, '\n'); - } - sqlite3_str_appendf(pErr, - "Opcode at %d within the " - "subroutine at %d..%d jumps to an unresolved " - "address (%d)\n", - i, iFirst, iLast, iDest); continue; } iDest = pParse->aLabel[j];