Return SQLITE_CORRUPT to the user if an attempt is made to add database page 1 to the free page list.
FossilOrigin-Name: 68876003f922635737349f55bc73a78891ea7028
This commit is contained in:
parent
c5b7358513
commit
fb0246ba8a
14
manifest
14
manifest
@ -1,5 +1,5 @@
|
||||
C Fix\sa\sproblem\swith\signoring\sUNIQUE\sconstraints\son\sWITHOUT\sROWID\stables\srendered\sredundant\sby\sthe\sPRIMARY\sKEY.
|
||||
D 2015-05-26T11:53:14.886
|
||||
C Return\sSQLITE_CORRUPT\sto\sthe\suser\sif\san\sattempt\sis\smade\sto\sadd\sdatabase\spage\s1\sto\sthe\sfree\spage\slist.
|
||||
D 2015-05-26T12:18:17.385
|
||||
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
||||
F Makefile.in 69b596e4be75a16f4e55587f29db66497b207fad
|
||||
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
||||
@ -192,7 +192,7 @@ F src/auth.c b56c78ebe40a2110fd361379f7e8162d23f92240
|
||||
F src/backup.c ff743689c4d6c5cb55ad42ed9d174b2b3e71f1e3
|
||||
F src/bitvec.c 5eb7958c3bf65210211cbcfc44eff86d0ded7c9d
|
||||
F src/btmutex.c 45a968cc85afed9b5e6cf55bf1f42f8d18107f79
|
||||
F src/btree.c a7d627f89e8382cea8645cc2eec6927b203fdb31
|
||||
F src/btree.c 8921e4d70b4e7b82f1380b548f9ba7180f06f8ee
|
||||
F src/btree.h 969adc948e89e449220ff0ff724c94bb2a52e9f1
|
||||
F src/btreeInt.h 973a22a6fd61350b454ad614832b1f0a5e25a1e4
|
||||
F src/build.c 9552e7490b0310a8c73fcf3a0c36e7624789d8df
|
||||
@ -452,7 +452,7 @@ F test/corruptE.test 193b4ca4e927e77c1d5f4f56203ddc998432a7ee
|
||||
F test/corruptF.test be9fde98e4c93648f1ba52b74e5318edc8f59fe4
|
||||
F test/corruptG.test 1ab3bf97ee7bdba70e0ff3ba2320657df55d1804
|
||||
F test/corruptH.test 5dd4fa98c6c1ed33b178f9e8a48c4fdd3cfc9067
|
||||
F test/corruptI.test 79fd060a42a965df1274f5ef5cba4d74bef7c892
|
||||
F test/corruptI.test 61e2a589a201b1de4fef59919a13a8458c3bedd0
|
||||
F test/corruptJ.test 9e29e7a81ee3b6ac50f77ea7a9e2f3fa03f32d91
|
||||
F test/cost.test 19d314526616ce4473eb4e4e450fcb94499ce318
|
||||
F test/count.test cb2e0f934c6eb33670044520748d2ecccd46259c
|
||||
@ -1279,7 +1279,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1
|
||||
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
|
||||
F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32
|
||||
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
|
||||
P d26060c468cc6997e9933d9623a47fcc7d86c2da
|
||||
R 5fc589e99d7c4f392d71685f4b89ca0e
|
||||
P 3b936913f3dc2cae4c94f983f28d85b136a44c9f
|
||||
R ee2ee5750218792d20f6412854d02033
|
||||
U dan
|
||||
Z 34e0e604424e8529b6d35704e87be1e0
|
||||
Z e4cd6153fb333675a2ebeb7e8f1f1bce
|
||||
|
@ -1 +1 @@
|
||||
3b936913f3dc2cae4c94f983f28d85b136a44c9f
|
||||
68876003f922635737349f55bc73a78891ea7028
|
@ -5600,9 +5600,10 @@ static int freePage2(BtShared *pBt, MemPage *pMemPage, Pgno iPage){
|
||||
int nFree; /* Initial number of pages on free-list */
|
||||
|
||||
assert( sqlite3_mutex_held(pBt->mutex) );
|
||||
assert( iPage>1 );
|
||||
assert( CORRUPT_DB || iPage>1 );
|
||||
assert( !pMemPage || pMemPage->pgno==iPage );
|
||||
|
||||
if( iPage<2 ) return SQLITE_CORRUPT_BKPT;
|
||||
if( pMemPage ){
|
||||
pPage = pMemPage;
|
||||
sqlite3PagerRef(pPage->pDbPage);
|
||||
|
@ -226,4 +226,30 @@ do_test 7.2 {
|
||||
catchsql { UPDATE t1 SET x='d' AND y='D' WHERE rowid = 2 }
|
||||
} {1 {database disk image is malformed}}
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
# At one point an assert() would fail if attempt was made to free page 1.
|
||||
#
|
||||
reset_db
|
||||
do_execsql_test 8.0 {
|
||||
CREATE TABLE t1(x);
|
||||
INSERT INTO t1 VALUES(zeroblob(300));
|
||||
INSERT INTO t1 VALUES(zeroblob(300));
|
||||
INSERT INTO t1 VALUES(zeroblob(300));
|
||||
INSERT INTO t1 VALUES(zeroblob(300));
|
||||
} {}
|
||||
|
||||
do_test 8.1 {
|
||||
db close
|
||||
hexio_write test.db [expr 1024 + 8] 00000001
|
||||
sqlite3 db test.db
|
||||
catchsql { DELETE FROM t1 }
|
||||
} {1 {database disk image is malformed}}
|
||||
|
||||
do_test 8.2 {
|
||||
db close
|
||||
sqlite3 db test.db
|
||||
execsql { PRAGMA integrity_check }
|
||||
} {/.*in database main.*/}
|
||||
|
||||
|
||||
finish_test
|
||||
|
Loading…
x
Reference in New Issue
Block a user