mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-08 14:02:16 +03:00
Asserts added to ensure that the iCompare variable in the bytecode engine
is correctly initialized before it is used. FossilOrigin-Name: 7b5900a111b9410f7d60c937e5a56304f2f66b94cd0881e94abcc5eedde52514
This commit is contained in:
12
manifest
12
manifest
@@ -1,5 +1,5 @@
|
||||
C Avoid\shaving\sto\sreinitialize\sVdbe.pResultRow\supon\seach\scall\sto\ssqlite3_step()\nfor\sa\ssmall\ssize\sreduction\sand\sperformance\sincrease.
|
||||
D 2022-12-22T19:12:48.752
|
||||
C Asserts\sadded\sto\sensure\sthat\sthe\siCompare\svariable\sin\sthe\sbytecode\sengine\nis\scorrectly\sinitialized\sbefore\sit\sis\sused.
|
||||
D 2022-12-22T21:32:58.656
|
||||
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
|
||||
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
|
||||
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
|
||||
@@ -717,7 +717,7 @@ F src/upsert.c 5303dc6c518fa7d4b280ec65170f465c7a70b7ac2b22491598f6d0b4875b3145
|
||||
F src/utf.c ee39565f0843775cc2c81135751ddd93eceb91a673ea2c57f61c76f288b041a0
|
||||
F src/util.c 313f3154e2b85a447326f5dd15de8d31a4df6ab0c3579bd58f426ff634ec9050
|
||||
F src/vacuum.c 84ce7f01f8a7a08748e107a441db83bcec13970190ddcb0c9ff522adbc1c23fd
|
||||
F src/vdbe.c 65097b1b8dc19096a547c0fa54f9e3821e9d513d536654e77c63e85b8f195f1f
|
||||
F src/vdbe.c 61fccecee1b1f1ba1e5e250dae33c8cec1b1ef5d3176cc69bea69f2754473fd5
|
||||
F src/vdbe.h 73b904a6b3bb27f308c6cc287a5751ebc7f1f89456be0ed068a12b92844c6e8c
|
||||
F src/vdbeInt.h fc15815b7bdafbb27e7f027faba2b0112e87d382c0d72241672528806ebc0db5
|
||||
F src/vdbeapi.c 4ee67890913c1d2469c68e3ad2e7ddeab57ac5924a64bbfd0906a8ea0d542c7f
|
||||
@@ -2067,8 +2067,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 1fd6211ef7bd26ed625177bfedfd5153ace547de6a71365ecfa076578d043f1a
|
||||
R d29f6177fe6e6d525f82d4157aa1b700
|
||||
P 6a00d67f5955ab86eea982c27b3a03b680fdf644ec63f49586ade6342a4d64a6
|
||||
R 04b1867006a44cfaff07f5cc142409fe
|
||||
U drh
|
||||
Z 0157da8e1ea08955e8449bebbef403a0
|
||||
Z f8e779d9bb555f0dbe2f776fde1b49c2
|
||||
# Remove this line to create a well-formed Fossil manifest.
|
||||
|
@@ -1 +1 @@
|
||||
6a00d67f5955ab86eea982c27b3a03b680fdf644ec63f49586ade6342a4d64a6
|
||||
7b5900a111b9410f7d60c937e5a56304f2f66b94cd0881e94abcc5eedde52514
|
@@ -713,6 +713,7 @@ int sqlite3VdbeExec(
|
||||
#ifdef SQLITE_DEBUG
|
||||
Op *pOrigOp; /* Value of pOp at the top of the loop */
|
||||
int nExtraDelete = 0; /* Verifies FORDELETE and AUXDELETE flags */
|
||||
u8 iCompareIsInit = 0; /* iCompare is initialized */
|
||||
#endif
|
||||
int rc = SQLITE_OK; /* Value to return */
|
||||
sqlite3 *db = p->db; /* The database */
|
||||
@@ -2125,18 +2126,21 @@ case OP_Ge: { /* same as TK_GE, jump, in1, in3 */
|
||||
goto jump_to_p2;
|
||||
}
|
||||
iCompare = +1;
|
||||
VVA_ONLY( iCompareIsInit = 1; )
|
||||
}else if( pIn3->u.i < pIn1->u.i ){
|
||||
if( sqlite3aLTb[pOp->opcode] ){
|
||||
VdbeBranchTaken(1, (pOp->p5 & SQLITE_NULLEQ)?2:3);
|
||||
goto jump_to_p2;
|
||||
}
|
||||
iCompare = -1;
|
||||
VVA_ONLY( iCompareIsInit = 1; )
|
||||
}else{
|
||||
if( sqlite3aEQb[pOp->opcode] ){
|
||||
VdbeBranchTaken(1, (pOp->p5 & SQLITE_NULLEQ)?2:3);
|
||||
goto jump_to_p2;
|
||||
}
|
||||
iCompare = 0;
|
||||
VVA_ONLY( iCompareIsInit = 1; )
|
||||
}
|
||||
VdbeBranchTaken(0, (pOp->p5 & SQLITE_NULLEQ)?2:3);
|
||||
break;
|
||||
@@ -2168,6 +2172,7 @@ case OP_Ge: { /* same as TK_GE, jump, in1, in3 */
|
||||
goto jump_to_p2;
|
||||
}
|
||||
iCompare = 1; /* Operands are not equal */
|
||||
VVA_ONLY( iCompareIsInit = 1; )
|
||||
break;
|
||||
}
|
||||
}else{
|
||||
@@ -2224,6 +2229,7 @@ case OP_Ge: { /* same as TK_GE, jump, in1, in3 */
|
||||
res2 = sqlite3aGTb[pOp->opcode];
|
||||
}
|
||||
iCompare = res;
|
||||
VVA_ONLY( iCompareIsInit = 1; )
|
||||
|
||||
/* Undo any changes made by applyAffinity() to the input registers. */
|
||||
assert( (pIn3->flags & MEM_Dyn) == (flags3 & MEM_Dyn) );
|
||||
@@ -2262,6 +2268,7 @@ case OP_ElseEq: { /* same as TK_ESCAPE, jump */
|
||||
break;
|
||||
}
|
||||
#endif /* SQLITE_DEBUG */
|
||||
assert( iCompareIsInit );
|
||||
VdbeBranchTaken(iCompare==0, 2);
|
||||
if( iCompare==0 ) goto jump_to_p2;
|
||||
break;
|
||||
@@ -2356,6 +2363,7 @@ case OP_Compare: {
|
||||
pColl = pKeyInfo->aColl[i];
|
||||
bRev = (pKeyInfo->aSortFlags[i] & KEYINFO_ORDER_DESC);
|
||||
iCompare = sqlite3MemCompare(&aMem[p1+idx], &aMem[p2+idx], pColl);
|
||||
VVA_ONLY( iCompareIsInit = 1; )
|
||||
if( iCompare ){
|
||||
if( (pKeyInfo->aSortFlags[i] & KEYINFO_ORDER_BIGNULL)
|
||||
&& ((aMem[p1+idx].flags & MEM_Null) || (aMem[p2+idx].flags & MEM_Null))
|
||||
@@ -2380,6 +2388,7 @@ case OP_Compare: {
|
||||
*/
|
||||
case OP_Jump: { /* jump */
|
||||
assert( pOp>aOp && pOp[-1].opcode==OP_Compare );
|
||||
assert( iCompareIsInit );
|
||||
if( iCompare<0 ){
|
||||
VdbeBranchTaken(0,4); pOp = &aOp[pOp->p1 - 1];
|
||||
}else if( iCompare==0 ){
|
||||
|
Reference in New Issue
Block a user