From: drh Date: Thu, 10 Nov 2011 02:39:28 +0000 (+0000) Subject: Follow-on to the previous check-in to prevent a division by zero if the X-Git-Tag: mountain-lion~9^2~17^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=61a4bd5c6cfc2d196dad5a5ab2929fec48f03e89;p=thirdparty%2Fsqlite.git Follow-on to the previous check-in to prevent a division by zero if the lookahead slot size is something goofy like 6 on a 32-bit machine. FossilOrigin-Name: 6bda711f93e753dd0be8d896a007b3f7b5064787 --- diff --git a/manifest b/manifest index 2d01a44018..51265bf5ec 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Use\ssqlite3MallocSize()\sto\sget\sthe\sactual\ssize\sof\sthe\smemory\sallocation\nused\sfor\slookaside\scache\sand\sincrease\sthe\ssize\sof\sthe\scache\sto\suse\sthe\nfull\sallocation. -D 2011-11-10T02:24:11.076 +C Follow-on\sto\sthe\sprevious\scheck-in\sto\sprevent\sa\sdivision\sby\szero\sif\sthe\nlookahead\sslot\ssize\sis\ssomething\sgoofy\slike\s6\son\sa\s32-bit\smachine. +D 2011-11-10T02:39:28.949 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 5b4a3e12a850b021547e43daf886b25133b44c07 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -147,7 +147,7 @@ F src/journal.c 552839e54d1bf76fb8f7abe51868b66acacf6a0e F src/legacy.c a199d7683d60cef73089e892409113e69c23a99f F src/lempar.c 0ee69fca0be54cd93939df98d2aca4ca46f44416 F src/loadext.c d0d2022a5a07274d408820b978b9e549189d314f -F src/main.c 666a78ff3495e6b598dfdf95470d94cdc7026b3e +F src/main.c 87dd4f6ee9b1700d54164ab4e14f2f7abc75486f F src/malloc.c 591aedb20ae40813f1045f2ef253438a334775d9 F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645 F src/mem1.c 7456e2ca0524609ebc06a9befeda5289d4575ad4 @@ -974,7 +974,7 @@ F tool/tostr.awk e75472c2f98dd76e06b8c9c1367f4ab07e122d06 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/warnings-clang.sh 9f406d66e750e8ac031c63a9ef3248aaa347ef2a F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381 -P 797a147934743a565c6f1f9dd4d41574690b4c2b -R 18d8d9d953fa089dbbd8eb3a1a1977dd +P 0e53ecad9468d0a13d155a4462551d4c234a7d5c +R fbf272ab03502c9559fd474b247cbcd0 U drh -Z 2aff7dca442feb19b2932365e48ed79f +Z f89d3293b31cf240feb4175eb6a1bbd3 diff --git a/manifest.uuid b/manifest.uuid index f0fb8356c2..6018b07c43 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -0e53ecad9468d0a13d155a4462551d4c234a7d5c \ No newline at end of file +6bda711f93e753dd0be8d896a007b3f7b5064787 \ No newline at end of file diff --git a/src/main.c b/src/main.c index 04110ce14e..27dacac1b2 100644 --- a/src/main.c +++ b/src/main.c @@ -482,22 +482,21 @@ static int setupLookaside(sqlite3 *db, void *pBuf, int sz, int cnt){ if( db->lookaside.bMalloced ){ sqlite3_free(db->lookaside.pStart); } - /* The size of a lookaside slot needs to be larger than a pointer - ** to be useful. + /* The size of a lookaside slot after ROUNDDOWN8 needs to be larger + ** than a pointer to be useful. */ + sz = ROUNDDOWN8(sz); /* IMP: R-33038-09382 */ if( sz<=(int)sizeof(LookasideSlot*) ) sz = 0; if( cnt<0 ) cnt = 0; if( sz==0 || cnt==0 ){ sz = 0; pStart = 0; }else if( pBuf==0 ){ - sz = ROUNDDOWN8(sz); /* IMP: R-33038-09382 */ sqlite3BeginBenignMalloc(); pStart = sqlite3Malloc( sz*cnt ); /* IMP: R-61949-35727 */ sqlite3EndBenignMalloc(); if( pStart ) cnt = sqlite3MallocSize(pStart)/sz; }else{ - sz = ROUNDDOWN8(sz); /* IMP: R-33038-09382 */ pStart = pBuf; } db->lookaside.pStart = pStart;