mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-07 02:42:48 +03:00
If OP_Rewind has P2 of zero, that is an assertion that the table is never
empty. This fixes a false-positive in the out-of-subroutine jump detection logic added in version 3.39.0, and which was causing the assertion on the previous check-in. FossilOrigin-Name: 33fd9997ebb88f0d78522c036e75aef08015d31d28b1cbee08ae7c4cd5ecc6aa
This commit is contained in:
12
src/vdbe.c
12
src/vdbe.c
@@ -6126,6 +6126,9 @@ case OP_Sort: { /* jump */
|
||||
** If the table or index is not empty, fall through to the following
|
||||
** instruction.
|
||||
**
|
||||
** If P2 is zero, that is an assertion that the P1 table is never
|
||||
** empty and hence the jump will never be taken.
|
||||
**
|
||||
** This opcode leaves the cursor configured to move in forward order,
|
||||
** from the beginning toward the end. In other words, the cursor is
|
||||
** configured to use Next, not Prev.
|
||||
@@ -6137,6 +6140,8 @@ case OP_Rewind: { /* jump, ncycle */
|
||||
|
||||
assert( pOp->p1>=0 && pOp->p1<p->nCursor );
|
||||
assert( pOp->p5==0 );
|
||||
assert( pOp->p2>=0 && pOp->p2<p->nOp );
|
||||
|
||||
pC = p->apCsr[pOp->p1];
|
||||
assert( pC!=0 );
|
||||
assert( isSorter(pC)==(pOp->opcode==OP_SorterSort) );
|
||||
@@ -6156,9 +6161,10 @@ case OP_Rewind: { /* jump, ncycle */
|
||||
}
|
||||
if( rc ) goto abort_due_to_error;
|
||||
pC->nullRow = (u8)res;
|
||||
assert( pOp->p2>0 && pOp->p2<p->nOp );
|
||||
VdbeBranchTaken(res!=0,2);
|
||||
if( res ) goto jump_to_p2;
|
||||
if( pOp->p2>0 ){
|
||||
VdbeBranchTaken(res!=0,2);
|
||||
if( res ) goto jump_to_p2;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user