]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
PRAGMA integrity_check returns SQLITE_OK even if it encounters corruption improved-integrity-check
authordrh <drh@noemail.net>
Wed, 13 Sep 2017 00:13:05 +0000 (00:13 +0000)
committerdrh <drh@noemail.net>
Wed, 13 Sep 2017 00:13:05 +0000 (00:13 +0000)
while scanning indexes.

FossilOrigin-Name: 81f62e99f27dedf3dc10fa1593c4cd9fc158680867206aee853e503a0cc8df71

manifest
manifest.uuid
src/pragma.c
src/vdbe.c
test/pragma.test

index 77107bb7d256f8f3547080a1514a56fcc69fcc4f..2141adaa03a1865f7a766cd9cddd593d210b5334 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Simplifications\sto\sthe\sPRAGMA\sintegrity_check\scode\sgenerator.
-D 2017-09-10T01:06:05.406
+C PRAGMA\sintegrity_check\sreturns\sSQLITE_OK\seven\sif\sit\sencounters\scorruption\nwhile\sscanning\sindexes.
+D 2017-09-13T00:13:05.025
 F Makefile.in c644bbe8ebe4aae82ad6783eae6b6beea4c727b99ff97568b847ced5e2ac7afb
 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
 F Makefile.msc 6a7a74bf60ad395098c0bd175ab054cd65ef85d7f034198d52bcc4d9e5fb4c6b
@@ -450,7 +450,7 @@ F src/parse.y 52ef3cecd0934e9da4a45b585883a03243ad615d338ad94f44501a05891dcdfa
 F src/pcache.c 4bada070456980c3c1f16d58ec2e64e389ad77b935e3d77e0c96e7bbd397289c
 F src/pcache.h 072f94d29281cffd99e46c1539849f248c4b56ae7684c1f36626797fee375170
 F src/pcache1.c 716975564c15eb6679e97f734cec1bfd6c16ac3d4010f05f1f8e509fc7d19880
-F src/pragma.c 3799864604c6ac706b7423eab2b6e59ec404559f347af505cf8fe8f2e3a7b509
+F src/pragma.c 88d99aa4752894aaf4102eefd09b5e497f4277661aff69f8fff61f8611f19d14
 F src/pragma.h bb83728944b42f6d409c77f5838a8edbdb0fe83046c5496ffc9602b40340a324
 F src/prepare.c 9a141a1b02dca53beaa9771699d390aafcac01f5d1f1c0ae6e23ded8dcdb709a
 F src/printf.c 40aee47ae9be4bd3dbdc8968bd07fddc027be8edec8daddf24d3391d36698a1c
@@ -525,7 +525,7 @@ F src/update.c 5404be9e840717323a69209190cdbc9d0d34adaedaaf1d1a1069babf2c4171c0
 F src/utf.c 810fbfebe12359f10bc2a011520a6e10879ab2a163bcb26c74768eab82ea62a5
 F src/util.c 773843506ce694714bc96fe67c30c37015f90ef515d0e70f1f8d5c9c24088152
 F src/vacuum.c 90839322fd5f00df9617eb21b68beda9b6e2a2937576b0d65985e4aeb1c53739
-F src/vdbe.c 82fc4553a0986a06bdd0d2b03a424e159bba5c74802fabb2841aa6cd27ccd962
+F src/vdbe.c 0a0ef7f0759ee4c3ed5ff0c6e9641216d4b31ebb0fea9a7b5a9c4a86ce875ff3
 F src/vdbe.h d50cadf12bcf9fb99117ef392ce1ea283aa429270481426b6e8b0280c101fd97
 F src/vdbeInt.h 1fe00770144c12c4913128f35262d11527ef3284561baaab59b947a41c08d0d9
 F src/vdbeapi.c 9c670ca0dcc1cd86373aa353b747b26fe531ca5cd4331690c611d1f03842e2a1
@@ -1095,7 +1095,7 @@ F test/pcache.test c8acbedd3b6fd0f9a7ca887a83b11d24a007972b
 F test/pcache2.test af7f3deb1a819f77a6d0d81534e97d1cf62cd442
 F test/percentile.test 4243af26b8f3f4555abe166f723715a1f74c77ff
 F test/permutations.test d911c9ba49088d22054a05dc73743f677872a92ac89288bcdeafa0ebf3f9c531
-F test/pragma.test faa8b64c4be28b67b3a0d3e9c977e2feff7dd2a4b08f2fd062a95d30f8c8fd1c
+F test/pragma.test 21b5a5c2e44121bb88a009b784b52c4e45b9d726c13963b1f6c38869970e0c95
 F test/pragma2.test e5d5c176360c321344249354c0c16aec46214c9f
 F test/pragma3.test 14c12bc5352b1e100e0b6b44f371053a81ccf8ed
 F test/pragma4.test 6e85b6eab8e61ffc9c7db59d842276674e8e3264
@@ -1652,7 +1652,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
 F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P b6425d0170721d803a055a958f1823c9c4be925cd93ac47562ff723daf8ce2ed
-R aac8ac34594edb6971d5273ddcaef89f
+P 99b9140c795c0c17c4e9d2547477c9dac056edfd443f2b2bd70edecd43c49ab7
+R a246d27aca858c3472ea60336e5e6182
 U drh
-Z f7ba7422ef3914964199f82bd5c4f921
+Z 6a3c45b7e13d2d307b1bb08e00187e8b
index d243f46ffdbc932f8b8daf29821d8e9c25d4f39c..4b4a5e69adc89c9840ffdf91909b9c62cc19e537 100644 (file)
@@ -1 +1 @@
-99b9140c795c0c17c4e9d2547477c9dac056edfd443f2b2bd70edecd43c49ab7
\ No newline at end of file
+81f62e99f27dedf3dc10fa1593c4cd9fc158680867206aee853e503a0cc8df71
\ No newline at end of file
index 9e7dc2be24193e15e7c6e8ff4a1f0a4ab995698b..29c83480fce578cc2fcaabcba08f5ccecc7ea49b 100644 (file)
@@ -1681,6 +1681,9 @@ void sqlite3Pragma(
         { OP_IfNotZero,   1, 4,        0},    /* 1 */
         { OP_String8,     0, 3,        0},    /* 2 */
         { OP_ResultRow,   3, 1,        0},    /* 3 */
+        { OP_Halt,        0, 0,        0},    /* 4 */
+        { OP_String8,     0, 3,        0},    /* 5 */
+        { OP_Goto,        0, 3,        0},    /* 6 */
       };
       VdbeOp *aOp;
 
@@ -1689,7 +1692,10 @@ void sqlite3Pragma(
         aOp[0].p2 = 1-mxErr;
         aOp[2].p4type = P4_STATIC;
         aOp[2].p4.z = "ok";
+        aOp[5].p4type = P4_STATIC;
+        aOp[5].p4.z = (char*)sqlite3ErrStr(SQLITE_CORRUPT);
       }
+      sqlite3VdbeChangeP3(v, 0, sqlite3VdbeCurrentAddr(v)-2);
     }
   }
   break;
index 70e745afe0e83b77d0d3bf9dd92ba0538237432b..37699bbba06152c1466603414693910705b4effa 100644 (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;
index cebbf9ddc0138c363edc1f682ef149e7fb0ab837..c0be5f4b3d673789d992856694327b99bcfc0a4b 100644 (file)
@@ -1952,7 +1952,7 @@ do_catchsql_test 24.1 {
 } {1 {database disk image is malformed}}
 do_catchsql_test 24.2 {
   PRAGMA integrity_check;
-} {1 {database disk image is malformed}}
+} {0 {{database disk image is malformed}}}
 
 database_never_corrupt
 finish_test