From: drh Date: Tue, 9 Jun 2009 18:02:10 +0000 (+0000) Subject: Require that the buffer specified by SQLITE_CONFIG_HEAP be 8-byte aligned. (CVS 6739) X-Git-Tag: version-3.6.15~21 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=39bf74a288bea5f29bd59f61d7f5b8a0560124bf;p=thirdparty%2Fsqlite.git Require that the buffer specified by SQLITE_CONFIG_HEAP be 8-byte aligned. (CVS 6739) FossilOrigin-Name: 18b78068cc94de51f081824c93f7b14c7c35726d --- diff --git a/manifest b/manifest index 45a1cdacb9..dc5a39cb0b 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Changes\sto\stokenize.c\sto\sfacilitate\sfull\scoverage\stesting.\s(CVS\s6738) -D 2009-06-09T18:01:38 +C Require\sthat\sthe\sbuffer\sspecified\sby\sSQLITE_CONFIG_HEAP\sbe\s8-byte\saligned.\s(CVS\s6739) +D 2009-06-09T18:02:10 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0 F Makefile.in 8b8fb7823264331210cddf103831816c286ba446 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 @@ -125,7 +125,7 @@ F src/insert.c 69ef88ce30d1f65315b57aba63b2d4e9bdca1090 F src/journal.c e00df0c0da8413ab6e1bb7d7cab5665d4a9000d0 F src/legacy.c 9a56cf126ceee332b56061bf16bd0fb4ff9e26c0 F src/loadext.c 0e88a335665db0b2fb4cece3e49dcb65d832635a -F src/main.c 1845bc74375dcd6c0f5f840c319c84a1f0e4f759 +F src/main.c 839ebfc7fa3b5a9f36223f536f6b5fef2a5ecf63 F src/malloc.c 7b3b6423f5b355e5d649b91e16ef252d610bcf19 F src/mem0.c f2f84062d1f35814d6535c9f9e33de3bfb3b132c F src/mem1.c e6d5c23941288df8191b8a98c28e3f57771e2270 @@ -160,7 +160,7 @@ F src/resolve.c f86d3490cf93a12f8a451720defc622cbc79873a F src/rowset.c c64dafba1f9fd876836c8db8682966b9d197eb1f F src/select.c 2d97084a176a63eabce2d043eb4fbb13c46d6e9f F src/shell.c db2643650b9268df89a4bedca3f1c6d9e786f1bb -F src/sqlite.h.in 79210c4d8905cfb4b038486dde5f36fabb796a86 +F src/sqlite.h.in e23556112022f04c9c49a4fc9871be16223250c3 F src/sqlite3ext.h 1db7d63ab5de4b3e6b83dd03d1a4e64fef6d2a17 F src/sqliteInt.h f8d70341d527404c5f162dc7fcc0f005700d0b48 F src/sqliteLimit.h ffe93f5a0c4e7bd13e70cd7bf84cfb5c3465f45d @@ -733,7 +733,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/vdbe-compress.tcl 672f81d693a03f80f5ae60bfefacd8a349e76746 -P ed1d4f47ee9a2bcafdee92ee6bfcb2b0d1758f76 -R a484012154ac91faa0af1a2719a7c8fa +P 5e8c48cff7e96e6030b796dba409844f4c758a60 +R cd4064526d818accd8a7986c2bb8a4af U drh -Z 0d3e67979c087a1a6baac804f1996882 +Z 7b1665741275b81f0c1d362ef376953e diff --git a/manifest.uuid b/manifest.uuid index 6a1073b767..3f8bec4d95 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -5e8c48cff7e96e6030b796dba409844f4c758a60 \ No newline at end of file +18b78068cc94de51f081824c93f7b14c7c35726d \ No newline at end of file diff --git a/src/main.c b/src/main.c index 941322a076..671dc356f8 100644 --- a/src/main.c +++ b/src/main.c @@ -14,7 +14,7 @@ ** other files are for internal use by SQLite and should not be ** accessed by users of the library. ** -** $Id: main.c,v 1.555 2009/06/01 16:53:10 shane Exp $ +** $Id: main.c,v 1.556 2009/06/09 18:02:10 drh Exp $ */ #include "sqliteInt.h" @@ -338,6 +338,11 @@ int sqlite3_config(int op, ...){ sqlite3GlobalConfig.nHeap = va_arg(ap, int); sqlite3GlobalConfig.mnReq = va_arg(ap, int); + /* Must have 8-byte alignment */ + if( ((sqlite3GlobalConfig.pHeap - (char*)0)&7)!=0 ){ + return SQLITE_MISUSE; + } + if( sqlite3GlobalConfig.pHeap==0 ){ /* If the heap pointer is NULL, then restore the malloc implementation ** back to NULL pointers too. This will cause the malloc to go @@ -349,7 +354,6 @@ int sqlite3_config(int op, ...){ /* The heap pointer is not NULL, then install one of the ** mem5.c/mem3.c methods. If neither ENABLE_MEMSYS3 nor ** ENABLE_MEMSYS5 is defined, return an error. - ** the default case and return an error. */ #ifdef SQLITE_ENABLE_MEMSYS3 sqlite3GlobalConfig.m = *sqlite3MemGetMemsys3(); diff --git a/src/sqlite.h.in b/src/sqlite.h.in index d2c7e5afd1..31cc5b2166 100644 --- a/src/sqlite.h.in +++ b/src/sqlite.h.in @@ -30,7 +30,7 @@ ** the version number) and changes its name to "sqlite3.h" as ** part of the build process. ** -** @(#) $Id: sqlite.h.in,v 1.455 2009/05/24 21:59:28 drh Exp $ +** @(#) $Id: sqlite.h.in,v 1.456 2009/06/09 18:02:10 drh Exp $ */ #ifndef _SQLITE3_H_ #define _SQLITE3_H_ @@ -1077,7 +1077,9 @@ struct sqlite3_mem_methods { ** undoing any prior invocation of [SQLITE_CONFIG_MALLOC]. If the ** memory pointer is not NULL and either [SQLITE_ENABLE_MEMSYS3] or ** [SQLITE_ENABLE_MEMSYS5] are defined, then the alternative memory -** allocator is engaged to handle all of SQLites memory allocation needs. +** allocator is engaged to handle all of SQLites memory allocation needs. +** The first pointer (the memory pointer) must be aligned to an 8-byte +** boundary or the behavior is undefined. ** **
SQLITE_CONFIG_MUTEX
**
This option takes a single argument which is a pointer to an