1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-07 02:42:48 +03:00

PRAGMA integrity_check returns SQLITE_OK even if it encounters corruption

while scanning indexes.

FossilOrigin-Name: 81f62e99f27dedf3dc10fa1593c4cd9fc158680867206aee853e503a0cc8df71
This commit is contained in:
drh
2017-09-13 00:13:05 +00:00
parent 9ecd7086c1
commit 74588ceb31
5 changed files with 31 additions and 15 deletions

View File

@@ -2461,8 +2461,7 @@ case OP_Column: {
** extra bytes for the header length itself. 32768*3 + 3 = 98307.
*/
if( aOffset[0] > 98307 || aOffset[0] > pC->payloadSize ){
rc = SQLITE_CORRUPT_BKPT;
goto abort_due_to_error;
goto op_column_corrupt;
}
}else{
/* This is an optimization. By skipping over the first few tests
@@ -2535,8 +2534,7 @@ case OP_Column: {
zHdr = zEndHdr;
}else{
if( pC->aRow==0 ) sqlite3VdbeMemRelease(&sMem);
rc = SQLITE_CORRUPT_BKPT;
goto abort_due_to_error;
goto op_column_corrupt;
}
}
@@ -2631,6 +2629,15 @@ op_column_out:
UPDATE_MAX_BLOBSIZE(pDest);
REGISTER_TRACE(pOp->p3, pDest);
break;
op_column_corrupt:
if( aOp[0].p3>0 ){
pOp = &aOp[aOp[0].p3-1];
break;
}else{
rc = SQLITE_CORRUPT_BKPT;
goto abort_due_to_error;
}
}
/* Opcode: Affinity P1 P2 * P4 *
@@ -7015,7 +7022,7 @@ case OP_Function: {
}
/* Opcode: Init P1 P2 * P4 *
/* Opcode: Init P1 P2 P3 P4 *
** Synopsis: Start at P2
**
** Programs contain a single instance of this opcode as the very first
@@ -7029,6 +7036,9 @@ case OP_Function: {
**
** Increment the value of P1 so that OP_Once opcodes will jump the
** first time they are evaluated for this run.
**
** If P3 is not zero, then it is an address to jump to if an SQLITE_CORRUPT
** error is encountered.
*/
case OP_Init: { /* jump */
char *zTrace;