SQLite

Check-in [d218993be5]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix an assert() failure in "PRAGMA integrity_check" that could occur when checking a corrupt database.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: d218993be5886f07193d5c2a66ccd0ecdd7bb87687947b89945c90e31cea5451
User & Date: dan 2024-10-07 11:47:05.013
Context
2024-10-07
12:19
Fix handling of U+fffd in the LIKE optimization. dbsqlfuzz eee57fb9eea1dfa5aa40dfa87865cf8c84d12f96. (check-in: bce52ce2a6 user: drh tags: trunk)
11:47
Fix an assert() failure in "PRAGMA integrity_check" that could occur when checking a corrupt database. (check-in: d218993be5 user: dan tags: trunk)
2024-10-05
21:44
Back out [2f7eab381e16] because the stderr output on systems without gmake causes grief in the testing tools. (check-in: cc6f3de032 user: stephan tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/pragma.c.
1757
1758
1759
1760
1761
1762
1763

1764
1765
1766
1767
1768
1769
1770
          aRoot[++cnt] = pIdx->tnum;
        }
      }
      aRoot[0] = cnt;

      /* Make sure sufficient number of registers have been allocated */
      sqlite3TouchRegister(pParse, 8+cnt);

      sqlite3ClearTempRegCache(pParse);

      /* Do the b-tree integrity checks */
      sqlite3VdbeAddOp4(v, OP_IntegrityCk, 1, cnt, 8, (char*)aRoot,P4_INTARRAY);
      sqlite3VdbeChangeP5(v, (u8)i);
      addr = sqlite3VdbeAddOp1(v, OP_IsNull, 2); VdbeCoverage(v);
      sqlite3VdbeAddOp4(v, OP_String8, 0, 3, 0,







>







1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
          aRoot[++cnt] = pIdx->tnum;
        }
      }
      aRoot[0] = cnt;

      /* Make sure sufficient number of registers have been allocated */
      sqlite3TouchRegister(pParse, 8+cnt);
      sqlite3VdbeAddOp3(v, OP_Null, 0, 8, 8+cnt);
      sqlite3ClearTempRegCache(pParse);

      /* Do the b-tree integrity checks */
      sqlite3VdbeAddOp4(v, OP_IntegrityCk, 1, cnt, 8, (char*)aRoot,P4_INTARRAY);
      sqlite3VdbeChangeP5(v, (u8)i);
      addr = sqlite3VdbeAddOp1(v, OP_IsNull, 2); VdbeCoverage(v);
      sqlite3VdbeAddOp4(v, OP_String8, 0, 3, 0,
Changes to test/corruptN.test.
271
272
273
274
275
276
277



























278
279
}
  
do_catchsql_test 6.3 {
  -- Run an UPDATE on t1 that will hit a child of page 136. Have the trigger
  -- clear page 136 and its children. Assert fails.
  UPDATE t1 SET x='hello world' WHERE rowid=1;
} {1 {database disk image is malformed}}




























finish_test







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>


271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
}
  
do_catchsql_test 6.3 {
  -- Run an UPDATE on t1 that will hit a child of page 136. Have the trigger
  -- clear page 136 and its children. Assert fails.
  UPDATE t1 SET x='hello world' WHERE rowid=1;
} {1 {database disk image is malformed}}

#-------------------------------------------------------------------------
reset_db
do_execsql_test 7.0 {
  BEGIN;
  CREATE TABLE p1(x PRIMARY KEY);
  CREATE TABLE c1(y);

  PRAGMA schema_version = 0;
  PRAGMA writable_schema = RESET;

  INSERT INTO c1 VALUES(1000);
  ROLLBACK;
}

do_execsql_test 7.1 {
  PRAGMA table_info = p1;
} {0 x {} 0 {} 1}

do_catchsql_test 7.2 {
  SELECT * FROM p1;
} {1 {database disk image is malformed}}

do_catchsql_test 7.3 {
  PRAGMA integrity_check
} {1 {database disk image is malformed}}


finish_test