1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-05 04:30:38 +03:00

Fix a bug on systems where malloc(0) return NULL.

Add code to detect this bug even on systems were it used not to
occur. (CVS 190)

FossilOrigin-Name: bda83e2b75843b9a078c2f4e64fcd4d2145a716b
This commit is contained in:
drh
2001-03-14 12:35:57 +00:00
parent 65cd7c02e7
commit b072950e24
6 changed files with 26 additions and 15 deletions

View File

@@ -1 +1 @@
1.0.23 1.0.24

View File

@@ -1,9 +1,9 @@
C Documentation\supdates\sonly\s(CVS\s189) C Fix\sa\sbug\son\ssystems\swhere\smalloc(0)\sreturn\sNULL.\nAdd\scode\sto\sdetect\sthis\sbug\seven\son\ssystems\swere\sit\sused\snot\sto\noccur.\s(CVS\s190)
D 2001-02-20T13:06:31 D 2001-03-14T12:35:57
F COPYRIGHT 74a8a6531a42e124df07ab5599aad63870fa0bd4 F COPYRIGHT 74a8a6531a42e124df07ab5599aad63870fa0bd4
F Makefile.in 7efa81e2985b45ba73db27d55b70cc927f5abfd7 F Makefile.in 7efa81e2985b45ba73db27d55b70cc927f5abfd7
F README 51f6a4e7408b34afa5bc1c0485f61b6a4efb6958 F README 51f6a4e7408b34afa5bc1c0485f61b6a4efb6958
F VERSION 5383ee1612cb9a5eeef8f9f925777798a509f326 F VERSION 404ea684e576d2b596e185903cea48b3e984c7fd
F configure 3dc1edb9dcf60215e31ff72b447935ab62211442 x F configure 3dc1edb9dcf60215e31ff72b447935ab62211442 x
F configure.in d892ca33db7e88a055519ce2f36dcb11020e8fff F configure.in d892ca33db7e88a055519ce2f36dcb11020e8fff
F doc/lemon.html e233a3e97a779c7a87e1bc4528c664a58e49dd47 F doc/lemon.html e233a3e97a779c7a87e1bc4528c664a58e49dd47
@@ -38,8 +38,8 @@ F src/table.c 5be76051a8ed6f6bfa641f4adc52529efa34fbf9
F src/tclsqlite.c 2a925e1835c348f07dd17c87d95ae9a577833407 F src/tclsqlite.c 2a925e1835c348f07dd17c87d95ae9a577833407
F src/test.file 55ca6286e3e4f4fba5d0448333fa99fc5a404a73 F src/test.file 55ca6286e3e4f4fba5d0448333fa99fc5a404a73
F src/tokenize.c c7ad428f38e56342eb2025320480b5ae9ece1b90 F src/tokenize.c c7ad428f38e56342eb2025320480b5ae9ece1b90
F src/update.c 9692fbac8e95fdbc5318d39db576aa6c57b9c8ab F src/update.c 8365b3922ea098330d1e20862d6e64911e4e03d0
F src/util.c 0298100e6427a4b644f767ede12276fa7170fbb6 F src/util.c f4573201fc2b581dbf601c53787349310b7da150
F src/vdbe.c e8254ae39d2f42a3f85b168b67a493ae206f4bf4 F src/vdbe.c e8254ae39d2f42a3f85b168b67a493ae206f4bf4
F src/vdbe.h 031b7dd7d6f94c51dc37cdf26efe43d1619bb672 F src/vdbe.h 031b7dd7d6f94c51dc37cdf26efe43d1619bb672
F src/where.c 478fde7c930969ca428de2d80b137959d25ee2fb F src/where.c 478fde7c930969ca428de2d80b137959d25ee2fb
@@ -80,7 +80,7 @@ F www/arch.fig 4f246003b7da23bd63b8b0af0618afb4ee3055c8
F www/arch.png 8dae0766d42ed3de9ed013c1341a5792bcf633e6 F www/arch.png 8dae0766d42ed3de9ed013c1341a5792bcf633e6
F www/arch.tcl a40380c1fe0080c43e6cc5c20ed70731511b06be F www/arch.tcl a40380c1fe0080c43e6cc5c20ed70731511b06be
F www/c_interface.tcl 11be2d5826eb7d6efd629751d3b483c1ed78ba14 F www/c_interface.tcl 11be2d5826eb7d6efd629751d3b483c1ed78ba14
F www/changes.tcl f4d2d919d87329555efb0639d2a9b9e2be46715c F www/changes.tcl c433eed27374aef00c4d4a9b6d072a182db4abd0
F www/crosscompile.tcl c99efacb3aefaa550c6e80d91b240f55eb9fd33e F www/crosscompile.tcl c99efacb3aefaa550c6e80d91b240f55eb9fd33e
F www/dynload.tcl 02eb8273aa78cfa9070dd4501dca937fb22b466c F www/dynload.tcl 02eb8273aa78cfa9070dd4501dca937fb22b466c
F www/fileformat.tcl cfb7fba80b7275555281ba2f256c00734bcdd1c9 F www/fileformat.tcl cfb7fba80b7275555281ba2f256c00734bcdd1c9
@@ -91,7 +91,7 @@ F www/opcode.tcl cb3a1abf8b7b9be9f3a228d097d6bf8b742c2b6f
F www/sqlite.tcl cb0d23d8f061a80543928755ec7775da6e4f362f F www/sqlite.tcl cb0d23d8f061a80543928755ec7775da6e4f362f
F www/tclsqlite.tcl 06f81c401f79a04f2c5ebfb97e7c176225c0aef2 F www/tclsqlite.tcl 06f81c401f79a04f2c5ebfb97e7c176225c0aef2
F www/vdbe.tcl 0c8aaa529dd216ccbf7daaabd80985e413d5f9ad F www/vdbe.tcl 0c8aaa529dd216ccbf7daaabd80985e413d5f9ad
P cbfa44c32365a1c9d10c9fcfeebad2fea139aafb P d44abe54eb4a0c5eedf8f3ff59704ddb8dd68faf
R 51dbb4fe2655a1b43c87ea8ebca2b24f R 6e3a5f2798796558e4d2cf33207362f9
U drh U drh
Z 14d4e5ae0729dab203dc2cf30932cb57 Z e11df66d76fd940262c38944939091a9

View File

@@ -1 +1 @@
d44abe54eb4a0c5eedf8f3ff59704ddb8dd68faf bda83e2b75843b9a078c2f4e64fcd4d2145a716b

View File

@@ -24,7 +24,7 @@
** This file contains C code routines that are called by the parser ** This file contains C code routines that are called by the parser
** to handle UPDATE statements. ** to handle UPDATE statements.
** **
** $Id: update.c,v 1.9 2001/01/15 22:51:11 drh Exp $ ** $Id: update.c,v 1.10 2001/03/14 12:35:57 drh Exp $
*/ */
#include "sqliteInt.h" #include "sqliteInt.h"
@@ -126,8 +126,10 @@ void sqliteUpdate(
} }
if( i<pIdx->nColumn ) nIdx++; if( i<pIdx->nColumn ) nIdx++;
} }
if( nIdx>0 ){
apIdx = sqliteMalloc( sizeof(Index*) * nIdx ); apIdx = sqliteMalloc( sizeof(Index*) * nIdx );
if( apIdx==0 ) goto update_cleanup; if( apIdx==0 ) goto update_cleanup;
}
for(nIdx=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){ for(nIdx=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
for(i=0; i<pIdx->nColumn; i++){ for(i=0; i<pIdx->nColumn; i++){
if( aXRef[pIdx->aiColumn[i]]>=0 ) break; if( aXRef[pIdx->aiColumn[i]]>=0 ) break;

View File

@@ -26,7 +26,7 @@
** This file contains functions for allocating memory, comparing ** This file contains functions for allocating memory, comparing
** strings, and stuff like that. ** strings, and stuff like that.
** **
** $Id: util.c,v 1.17 2000/12/10 18:23:51 drh Exp $ ** $Id: util.c,v 1.18 2001/03/14 12:35:57 drh Exp $
*/ */
#include "sqliteInt.h" #include "sqliteInt.h"
#include <stdarg.h> #include <stdarg.h>
@@ -60,6 +60,7 @@ void *sqliteMalloc_(int n, char *zFile, int line){
sqlite_iMallocFail--; sqlite_iMallocFail--;
if( sqlite_iMallocFail==0 ) return 0; if( sqlite_iMallocFail==0 ) return 0;
} }
if( n==0 ) return 0;
k = (n+sizeof(int)-1)/sizeof(int); k = (n+sizeof(int)-1)/sizeof(int);
pi = malloc( (3+k)*sizeof(int)); pi = malloc( (3+k)*sizeof(int));
if( pi==0 ) return 0; if( pi==0 ) return 0;

View File

@@ -17,6 +17,14 @@ proc chng {date desc} {
puts "<DD><P><UL>$desc</UL></P></DD>" puts "<DD><P><UL>$desc</UL></P></DD>"
} }
chng {2001 Mar 14 19 (1.0.24)} {
<li>Fix a bug which was causing
the UPDATE command was failing on systems where "malloc(0)" returns
NULL. The problem does not appear Windows, Linux, or HPUX but does
cause the library to fail on QNX.
</li>
}
chng {2001 Feb 19 (1.0.23)} { chng {2001 Feb 19 (1.0.23)} {
<li>An unrelated (and minor) bug from Mark Muranwski fixed. The algorithm <li>An unrelated (and minor) bug from Mark Muranwski fixed. The algorithm
for figuring out where to put temporary files for a "memory:" database for figuring out where to put temporary files for a "memory:" database