From ef31c6aa9792eed22b52e574229b09f965d90677 Mon Sep 17 00:00:00 2001 From: drh Date: Thu, 2 Apr 2009 09:07:12 +0000 Subject: [PATCH] Enforce the run-time sqlite3_limit() length limit on zeroblob(), not just the compile-time SQLITE_MAX_LENGTH limit. (CVS 6433) FossilOrigin-Name: a04f9e7959325da18f66a1aa4ead1c50993807cb --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/func.c | 7 ++++--- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/manifest b/manifest index ed584a7efc..edf79d2a77 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Increase\stest\scoverage\sof\sbitvec.c\sslightly.\s\sFix\sthe\sline\slength\son\sa\ncomment\sin\sbitvec.c.\s(CVS\s6432) -D 2009-04-01T23:49:04 +C Enforce\sthe\srun-time\ssqlite3_limit()\slength\slimit\son\szeroblob(),\snot\sjust\nthe\scompile-time\sSQLITE_MAX_LENGTH\slimit.\s(CVS\s6433) +D 2009-04-02T09:07:13 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0 F Makefile.in 583e87706abc3026960ed759aff6371faf84c211 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 @@ -113,7 +113,7 @@ F src/date.c e6263ed8950642f593cb1a2cc8a73dd726cc7888 F src/delete.c eb1066b2f35489fee46ad765d2b66386fc7d8adf F src/expr.c 14853cd56107292de6af664a24c6255111a4257d F src/fault.c dc88c821842157460750d2d61a8a8b4197d047ff -F src/func.c 1d6a8689443b15a3845e805a6ad97317b37af3fb +F src/func.c ac81b4ff36e4e52327097dfcf6a1ba90d9cb63f7 F src/global.c 448419c44ce0701104c2121b0e06919b44514c0c F src/hash.c 5824e6ff7ba78cd34c8d6cd724367713583e5b55 F src/hash.h 28f38ebb1006a5beedcb013bcdfe31befe7437ae @@ -714,7 +714,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81 F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e -P 05c182a5db9fa96f2d588dd884ce77916b0e60e4 -R 736fecdc86bd337187f07f38299efc83 +P ca3aa3ba7d751be1c2bcd100a203cd9c794a6cef +R f0264cae48013af5fa04e1ada66682c2 U drh -Z 0436fb87186a0b07c69c73ce8e383e5b +Z 3903933557343f546c355318654d5fcd diff --git a/manifest.uuid b/manifest.uuid index 9724ad2b72..46e0bf15c5 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -ca3aa3ba7d751be1c2bcd100a203cd9c794a6cef \ No newline at end of file +a04f9e7959325da18f66a1aa4ead1c50993807cb \ No newline at end of file diff --git a/src/func.c b/src/func.c index 85ec68b73f..baedf178b3 100644 --- a/src/func.c +++ b/src/func.c @@ -16,7 +16,7 @@ ** sqliteRegisterBuildinFunctions() found at the bottom of the file. ** All other code has file scope. ** -** $Id: func.c,v 1.226 2009/04/01 16:33:38 drh Exp $ +** $Id: func.c,v 1.227 2009/04/02 09:07:13 drh Exp $ */ #include "sqliteInt.h" #include @@ -270,12 +270,13 @@ static void roundFunc(sqlite3_context *context, int argc, sqlite3_value **argv){ */ static void *contextMalloc(sqlite3_context *context, i64 nByte){ char *z; + assert( nByte>0 ); if( nByte>sqlite3_context_db_handle(context)->aLimit[SQLITE_LIMIT_LENGTH] ){ sqlite3_result_error_toobig(context); z = 0; }else{ z = sqlite3Malloc((int)nByte); - if( !z && nByte>0 ){ + if( !z ){ sqlite3_result_error_nomem(context); } } @@ -811,7 +812,7 @@ static void zeroblobFunc( assert( argc==1 ); UNUSED_PARAMETER(argc); n = sqlite3_value_int64(argv[0]); - if( n>SQLITE_MAX_LENGTH ){ + if( n>sqlite3_context_db_handle(context)->aLimit[SQLITE_LIMIT_LENGTH] ){ sqlite3_result_error_toobig(context); }else{ sqlite3_result_zeroblob(context, (int)n); -- 2.47.2