Fix the readfile() UDF so that it returns an empty BLOB, not an OOM error,
when reading an empty file. FossilOrigin-Name: 0edad5339e36d69aed9289bb3e60d35f9930386d76a62bb0194c4fdf420d16fb
This commit is contained in:
parent
89d249364e
commit
0319934322
@ -152,13 +152,13 @@ static void readFileContents(sqlite3_context *ctx, const char *zName){
|
||||
fclose(in);
|
||||
return;
|
||||
}
|
||||
pBuf = sqlite3_malloc64( nIn );
|
||||
pBuf = sqlite3_malloc64( nIn ? nIn : 1 );
|
||||
if( pBuf==0 ){
|
||||
sqlite3_result_error_nomem(ctx);
|
||||
fclose(in);
|
||||
return;
|
||||
}
|
||||
if( 1==fread(pBuf, nIn, 1, in) ){
|
||||
if( nIn==fread(pBuf, 1, nIn, in) ){
|
||||
sqlite3_result_blob64(ctx, pBuf, nIn, sqlite3_free);
|
||||
}else{
|
||||
sqlite3_result_error_code(ctx, SQLITE_IOERR);
|
||||
|
14
manifest
14
manifest
@ -1,5 +1,5 @@
|
||||
C Add\sthe\s"-returntype"\soption\sto\sthe\s"db\sfunction"\sTcl\smethod.
|
||||
D 2019-02-27T16:38:19.320
|
||||
C Fix\sthe\sreadfile()\sUDF\sso\sthat\sit\sreturns\san\sempty\sBLOB,\snot\san\sOOM\serror,\nwhen\sreading\san\sempty\sfile.
|
||||
D 2019-02-27T19:59:56.536
|
||||
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
|
||||
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
|
||||
F Makefile.in 1ad7263f38329c0ecea543c80f30af839ee714ea77fc391bf1a3fbb919a5b6b5
|
||||
@ -285,7 +285,7 @@ F ext/misc/csv.c 7f047aeb68f5802e7ce6639292095d622a488bb43526ed04810e0649faa71ce
|
||||
F ext/misc/dbdump.c baf6e37447c9d6968417b1cd34cbedb0b0ab3f91b5329501d8a8d5be3287c336
|
||||
F ext/misc/eval.c 4b4757592d00fd32e44c7a067e6a0e4839c81a4d57abc4131ee7806d1be3104e
|
||||
F ext/misc/explain.c d5c12962d79913ef774b297006872af1fccda388f61a11d37758f9179a09551f
|
||||
F ext/misc/fileio.c 592d6531d8413d81b25f5a47a45d7e310e455d33e03a64c6ae85724c6524a5d5
|
||||
F ext/misc/fileio.c e7864c391e14ccaf73ee4b22f5a55c1eb40ecc93a7f5ee77a1b41b87367ec7ae
|
||||
F ext/misc/fossildelta.c 3cc9a9b2f39889b43cd176c19f286bc7dd652f4c202c202d008481252d820316
|
||||
F ext/misc/fuzzer.c 9e79c337faffdd4c5fe4485467537438359b43e0858a40038d4300b894ff553f
|
||||
F ext/misc/ieee754.c f190d0cc5182529acb15babd177781be1ac1718c
|
||||
@ -1805,7 +1805,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
|
||||
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
|
||||
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
|
||||
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
|
||||
P 122330dba3eb2492875bd02a46442306f73e251408447af5e5914ee0c8d6a110
|
||||
R 4166c9e01ccb9a254eef55033738e8bf
|
||||
U dan
|
||||
Z f227401976c706870557af555984f5d5
|
||||
P 789a492b68c353e2b763d67d399722b7ab61bfe09b472466df2821f65cab1be9
|
||||
R 8430a5ae199ad097ee7aa582e73883cd
|
||||
U drh
|
||||
Z 4cf753a6552dd62b27fdf5e7f3a478a4
|
||||
|
@ -1 +1 @@
|
||||
789a492b68c353e2b763d67d399722b7ab61bfe09b472466df2821f65cab1be9
|
||||
0edad5339e36d69aed9289bb3e60d35f9930386d76a62bb0194c4fdf420d16fb
|
Loading…
Reference in New Issue
Block a user