1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-15 11:41:13 +03:00

Require that the buffer specified by SQLITE_CONFIG_HEAP be 8-byte aligned. (CVS 6739)

FossilOrigin-Name: 18b78068cc94de51f081824c93f7b14c7c35726d
This commit is contained in:
drh
2009-06-09 18:02:10 +00:00
parent 19f81f6cdd
commit 39bf74a288
4 changed files with 18 additions and 12 deletions

View File

@@ -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();