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

Fix a problem in btree.c preventing an OOM error from being propagated up to the caller. (CVS 5677)

FossilOrigin-Name: 0b8ee83f2ebadab099ccd6490f6995949dafdd6f
This commit is contained in:
danielk1977
2008-09-05 05:02:46 +00:00
parent 0a732f59b0
commit 518002e4ba
4 changed files with 34 additions and 11 deletions

View File

@@ -1,5 +1,5 @@
C Add\ssupport\sfor\sthe\sSQLITE_THREADSAFE=2\sand\sSQLITE_DEFAULT_MEMSTATUS\scompilation\soptions.\s(CVS\s5676)
D 2008-09-04T17:17:39
C Fix\sa\sproblem\sin\sbtree.c\spreventing\san\sOOM\serror\sfrom\sbeing\spropagated\sup\sto\sthe\scaller.\s(CVS\s5677)
D 2008-09-05T05:02:47
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in 689e14735f862a5553bceef206d8c13e29504e44
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -97,7 +97,7 @@ F src/attach.c db3f4a60538733c1e4dcb9d0217a6e0d6ccd615b
F src/auth.c c8b2ab5c8bad4bd90ed7c294694f48269162c627
F src/bitvec.c 95c86bd18d8fedf0533f5af196192546e10a7e7d
F src/btmutex.c 709cad2cdca0afd013f0f612363810e53f59ec53
F src/btree.c 70706ed6c15a2b6f37b84454386d80fe8ff3a58a
F src/btree.c 6ea37de364f483496f60e47c996b429a9f313d54
F src/btree.h 6371c5e599fab391a150c96afbc10062b276d107
F src/btreeInt.h ab18c7b4980314e9e4b402e5dcde09f3c2545576
F src/build.c 160c71acca8f643f436ed6c1ee2f684c88df4dfe
@@ -401,7 +401,7 @@ F test/lock4.test 09d97d52cae18fadfe631552af9880dac6b3ae90
F test/lock5.test f4eeb0400cf65c37f733cb3c74401136f8c46acd
F test/lookaside.test 8866ea41301d74993423c99e523322fca09c259e
F test/main.test 8d77c161757ef7d96eaff0413daa7120c3b316fe
F test/malloc.test f87273951a359a391b3074e1cb758fe8ca2113d5
F test/malloc.test cdc0bb8675b972f56bffdb48e7d52a18500ff66f
F test/malloc3.test 094f8195fe8e409bd4da0f1d769f7745faec62c8
F test/malloc4.test 957337613002b7058a85116493a262f679f3a261
F test/malloc5.test c8d0f7673337e8a29afa558735ae937a0d629751
@@ -630,7 +630,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81
F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 1dbced29de5f59ba2ebf877edcadf171540374d1
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
P 56d618957571f65e88375aad34a6e7dcf22508e1
R 7f31a60d7476d173a3ef83e79848a29e
P 85c2a58901338c1c4652c2cbee51e5f48d289191
R a58a9043fd7c8bb950e6474043bc3a9e
U danielk1977
Z aacf6403f17f1bb9a05d92d3dbd05d57
Z d05200e95cbfe7a62e09a0f5c4e8f02b

View File

@@ -1 +1 @@
85c2a58901338c1c4652c2cbee51e5f48d289191
0b8ee83f2ebadab099ccd6490f6995949dafdd6f

View File

@@ -9,7 +9,7 @@
** May you share freely, never taking more than you give.
**
*************************************************************************
** $Id: btree.c,v 1.508 2008/09/02 14:07:24 danielk1977 Exp $
** $Id: btree.c,v 1.509 2008/09/05 05:02:47 danielk1977 Exp $
**
** This file implements a external (disk-based) database using BTrees.
** See the header comment on "btreeInt.h" for additional information.
@@ -3593,7 +3593,7 @@ static int moveToRightmost(BtCursor *pCur){
pCur->info.nSize = 0;
pCur->validNKey = 0;
}
return SQLITE_OK;
return rc;
}
/* Move the cursor to the first entry in the table. Return SQLITE_OK

View File

@@ -16,7 +16,7 @@
# to see what happens in the library if a malloc were to really fail
# due to an out-of-memory situation.
#
# $Id: malloc.test,v 1.64 2008/08/27 19:01:58 danielk1977 Exp $
# $Id: malloc.test,v 1.65 2008/09/05 05:02:47 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@@ -613,6 +613,29 @@ do_malloc_test 25 -sqlprep {
}
}
# This test is designed to test a specific juncture in the sqlite code.
# The database set up by -sqlprep script contains a single table B-Tree
# of height 2. In the -tclbody script, the existing database connection
# is closed and a new one opened and used to insert a new row into the
# table B-Tree. By using a new connection, the outcome of a malloc()
# failure while seeking to the right-hand side of the B-Tree to insert
# a new record can be tested.
#
do_malloc_test 26 -sqlprep {
BEGIN;
CREATE TABLE t1(a, b);
INSERT INTO t1 VALUES(1, randomblob(210));
INSERT INTO t1 VALUES(1, randomblob(210));
INSERT INTO t1 VALUES(1, randomblob(210));
INSERT INTO t1 VALUES(1, randomblob(210));
INSERT INTO t1 VALUES(1, randomblob(210));
COMMIT;
} -tclbody {
db close
sqlite3 db test.db
db eval { INSERT INTO t1 VALUES(1, randomblob(210)) }
}
# Ensure that no file descriptors were leaked.
do_test malloc-99.X {
catch {db close}