Fix a bug in PRAGMA integrity_check introduced by enhancement (8a) in

[https://sqlite.org/releaselog/3_42_0.html|release 3.42.0] and first reported by
[forum:/forumpost/ee4f6fa5ab|forum post ee4f6fa5ab].

FossilOrigin-Name: 460353dfff8f2fb03f9c8666d0c367ec7be4cfa96dfcb0cea10f144d043223bb
This commit is contained in:
drh 2024-02-13 18:41:46 +00:00
parent 54eb54c7de
commit 95b5295f52
4 changed files with 24 additions and 8 deletions

View File

@ -1,5 +1,5 @@
C Changes\sto\svtabCallConstructor()\sto\savoid\sa\sharmless\sstatic\sanalyzer\swarning\nand\sto\shelp\sprove\sthat\sthe\sUAF\sreported\sby\n[forum:/forumpost/cafbe582e8|forum\spost\scafbe582e8]\sis\sa\sfalse-positive.
D 2024-02-13T17:11:19.402
C Fix\sa\sbug\sin\sPRAGMA\sintegrity_check\sintroduced\sby\senhancement\s(8a)\sin\n[https://sqlite.org/releaselog/3_42_0.html|release\s3.42.0]\sand\sfirst\sreported\sby\n[forum:/forumpost/ee4f6fa5ab|forum\spost\see4f6fa5ab].
D 2024-02-13T18:41:46.416
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@ -732,7 +732,7 @@ F src/parse.y bfd6da46fc895cd8237400ff485d04ab0b32e47eb56de20982bb7f53e56c1f42
F src/pcache.c 040b165f30622a21b7a9a77c6f2e4877a32fb7f22d4c7f0d2a6fa6833a156a75
F src/pcache.h 1497ce1b823cf00094bb0cf3bac37b345937e6f910890c626b16512316d3abf5
F src/pcache1.c 602acb23c471bb8d557a6f0083cc2be641d6cafcafa19e481eba7ef4c9ca0f00
F src/pragma.c 017c04c842da70c04f31df5163d139e01693fdaa48a9058843fd520eee0ad426
F src/pragma.c b61a1a1801befe6763e787b96988deb156a56e82a2b4dea004bc78e4551c9d5c
F src/pragma.h e690a356c18e98414d2e870ea791c1be1545a714ba623719deb63f7f226d8bb7
F src/prepare.c 371f6115cb69286ebc12c6f2d7511279c2e47d9f54f475d46a554d687a3b312c
F src/printf.c 18fbdf028345c8fbe6044f5f5bfda5a10d48d6287afef088cc21b0ca57985640
@ -1482,7 +1482,7 @@ F test/pendingrace.test 6aa33756b950c4529f79c4f3817a9a1e4025bd0d9961571a05c0279b
F test/percentile.test 4243af26b8f3f4555abe166f723715a1f74c77ff
F test/permutations.test f7caf8dd5c7b1da74842a48df116f7f193399c656d4ffc805cd0d9658568c675
F test/pg_common.tcl 3b27542224db1e713ae387459b5d117c836a5f6e328846922993b6d2b7640d9f
F test/pragma.test 57a36226218c03cfb381019fe43234b2cefbd8a1f12825514f906a17ccf7991e
F test/pragma.test cddd4b534d7fb5cf113d1308dea4231f3548e8a7f3a65d7d1cf4810c87090b5a
F test/pragma2.test e5d5c176360c321344249354c0c16aec46214c9f
F test/pragma3.test 92a46bbea12322dd94a404f49edcfbfc913a2c98115f0d030a7459bb4712ef31
F test/pragma4.test ca5e4dfc46adfe490f75d73734f70349d95a199e6510973899e502eef2c8b1f8
@ -2162,8 +2162,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 189a49f165dfc348a8730ad2b2288b9b2b2089b1de99fa2d515f2a90c9e7bd4e
R c17ff8a1420ebd333737eedeb07f4b72
P 4892440b93306e5a245f18c0d3d295d851e6712260e420016c0d70e12abf8901
R 6caa0669ab38f9f6a39aaa796ed2bee2
U drh
Z 905b73f73ae952da68046cffedfa5860
Z f4541a674d73c1bd74cd3c989d7c9de5
# Remove this line to create a well-formed Fossil manifest.

View File

@ -1 +1 @@
4892440b93306e5a245f18c0d3d295d851e6712260e420016c0d70e12abf8901
460353dfff8f2fb03f9c8666d0c367ec7be4cfa96dfcb0cea10f144d043223bb

View File

@ -1897,6 +1897,7 @@ void sqlite3Pragma(
** is REAL, we have to load the actual data using OP_Column
** to reliably determine if the value is a NULL. */
sqlite3VdbeAddOp3(v, OP_Column, p1, p3, 3);
sqlite3ColumnDefault(v, pTab, j, 3);
jmp3 = sqlite3VdbeAddOp2(v, OP_NotNull, 3, labelOk);
VdbeCoverage(v);
}

View File

@ -556,6 +556,21 @@ ifcapable altertable {
do_execsql_test pragma-3.23 {
PRAGMA integrity_check(1);
} {{non-unique entry in index t1a}}
# forum post https://sqlite.org/forum/forumpost/ee4f6fa5ab
do_execsql_test pragma-3.24 {
DROP TABLE IF EXISTS t1;
CREATE TABLE t1(a);
INSERT INTO t1 VALUES (1);
ALTER TABLE t1 ADD COLUMN b NOT NULL DEFAULT 0.25;
SELECT * FROM t1;
PRAGMA integrity_check(t1);
} {1 0.25 ok}
do_execsql_test pragma-3.25 {
ALTER TABLE t1 ADD COLUMN c CHECK (1);
SELECT * FROM t1;
PRAGMA integrity_check(t1);
} {1 0.25 {} ok}
}
# PRAGMA integrity check (or more specifically the sqlite3BtreeCount()