mirror of https://github.com/sqlite/sqlite
Better handle a malloc() failure in sqlite3PagerSetPagesize(). (CVS 4332)
FossilOrigin-Name: 41550d87c9395ab2fec5993655865e29235130a3
This commit is contained in:
parent
f3c626594e
commit
992772c867
14
manifest
14
manifest
|
@ -1,5 +1,5 @@
|
|||
C Fix\sa\sbug\sin\sa\stest\sfile\scausing\smalloc5.test\sto\scrash.\s(CVS\s4331)
|
||||
D 2007-08-30T08:27:40
|
||||
C Better\shandle\sa\smalloc()\sfailure\sin\ssqlite3PagerSetPagesize().\s(CVS\s4332)
|
||||
D 2007-08-30T10:07:39
|
||||
F Makefile.in bfcc303429a5d9dcd552d807ee016c77427418c3
|
||||
F Makefile.linux-gcc 65241babba6faf1152bf86574477baab19190499
|
||||
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
|
||||
|
@ -123,7 +123,7 @@ F src/os_win.h 41a946bea10f61c158ce8645e7646b29d44f122b
|
|||
F src/pager.c 847674a74c232f3f7c386d4b902df41a60f781c4
|
||||
F src/pager.h 1ac4468049348ec72df09d138fc1d7e3a9d0d3a6
|
||||
F src/parse.y 2d2ce439dc6184621fb0b86f4fc5aca7f391a590
|
||||
F src/pragma.c 65109b3d6a62f9a0d64e739653b76afa1122a00d
|
||||
F src/pragma.c 59a5e12ad0972ca2403503c12efb77f208c9a144
|
||||
F src/prepare.c 1506fd279824b1f4bac97514966d0370101f9a6b
|
||||
F src/printf.c e8cb99691b8370d0b721e2618db0ad01550e9b98
|
||||
F src/random.c 4a22746501bf36b0a088c66e38dde5daba6a35da
|
||||
|
@ -404,7 +404,7 @@ F test/server1.test f5b790d4c0498179151ca8a7715a65a7802c859c
|
|||
F test/shared.test 08b30d5f1939efff0517e7ff8ec7b74ad31c151b
|
||||
F test/shared2.test 0ee9de8964d70e451936a48c41cb161d9134ccf4
|
||||
F test/shared3.test 01e3e124dbb3859788aabc7cfb82f7ea04421749
|
||||
F test/shared_err.test ae8ba4ccca50e742c1b5fdbd504a2a0f3b3e67dd
|
||||
F test/shared_err.test 68455ec2f7f250d2e89f17b0c98ecf94009e6800
|
||||
F test/soak.test 64f9b27fbcdec43335a88c546ce1983e6ba40d7b
|
||||
F test/softheap1.test 0c49aa6eee25e7d32943e85e8d1f20eff566b1dc
|
||||
F test/sort.test 0e4456e729e5a92a625907c63dcdedfbe72c5dc5
|
||||
|
@ -568,7 +568,7 @@ F www/tclsqlite.tcl 8be95ee6dba05eabcd27a9d91331c803f2ce2130
|
|||
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
|
||||
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
|
||||
F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5
|
||||
P 481fd3a89e50e329596d96565170e3d9977aae29
|
||||
R d13eabcd88c2079e0e183a72f4935be0
|
||||
P ab09967bd2dd291030850d44c0862fbb7d0d8118
|
||||
R b9c3cb63cea1b04e6323af6e1a9dc25c
|
||||
U danielk1977
|
||||
Z 1ec28bb5a6454a9a162a1baa77f48c30
|
||||
Z e4e84e997e319c0541326d008ac33a40
|
||||
|
|
|
@ -1 +1 @@
|
|||
ab09967bd2dd291030850d44c0862fbb7d0d8118
|
||||
41550d87c9395ab2fec5993655865e29235130a3
|
|
@ -11,7 +11,7 @@
|
|||
*************************************************************************
|
||||
** This file contains code used to implement the PRAGMA command.
|
||||
**
|
||||
** $Id: pragma.c,v 1.147 2007/08/30 01:19:59 drh Exp $
|
||||
** $Id: pragma.c,v 1.148 2007/08/30 10:07:39 danielk1977 Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
#include <ctype.h>
|
||||
|
@ -337,7 +337,12 @@ void sqlite3Pragma(
|
|||
int size = pBt ? sqlite3BtreeGetPageSize(pBt) : 0;
|
||||
returnSingleInt(pParse, "page_size", size);
|
||||
}else{
|
||||
sqlite3BtreeSetPageSize(pBt, atoi(zRight), -1);
|
||||
/* Malloc may fail when setting the page-size, as there is an internal
|
||||
** buffer that the pager module resizes using sqlite3_realloc().
|
||||
*/
|
||||
if( SQLITE_NOMEM==sqlite3BtreeSetPageSize(pBt, atoi(zRight), -1) ){
|
||||
db->mallocFailed = 1;
|
||||
}
|
||||
}
|
||||
}else
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# cache context. What happens to connection B if one connection A encounters
|
||||
# an IO-error whilst reading or writing the file-system?
|
||||
#
|
||||
# $Id: shared_err.test,v 1.15 2007/08/30 02:26:54 drh Exp $
|
||||
# $Id: shared_err.test,v 1.16 2007/08/30 10:07:39 danielk1977 Exp $
|
||||
|
||||
proc skip {args} {}
|
||||
|
||||
|
@ -433,6 +433,30 @@ do_test shared_malloc-8.X {
|
|||
expr $::aborted>=1
|
||||
} {1}
|
||||
|
||||
# This test is designed to catch a specific bug that was present during
|
||||
# development of 3.5.0. If a malloc() failed while setting the page-size,
|
||||
# a buffer (Pager.pTmpSpace) was being freed. This could cause a seg-fault
|
||||
# later if another connection tried to use the pager.
|
||||
#
|
||||
# This test will crash 3.4.2.
|
||||
#
|
||||
do_malloc_test shared_err-9 -tclprep {
|
||||
sqlite3 db2 test.db
|
||||
} -sqlbody {
|
||||
PRAGMA page_size = 4096;
|
||||
PRAGMA page_size = 1024;
|
||||
} -cleanup {
|
||||
db2 eval {
|
||||
CREATE TABLE abc(a, b, c);
|
||||
BEGIN;
|
||||
INSERT INTO abc VALUES(1, 2, 3);
|
||||
ROLLBACK;
|
||||
}
|
||||
db2 close
|
||||
}
|
||||
|
||||
|
||||
catch {db close}
|
||||
catch {db2 close}
|
||||
sqlite3_enable_shared_cache $::enable_shared_cache
|
||||
finish_test
|
||||
|
|
Loading…
Reference in New Issue