In the blob test code, avoid crashing on low-memory systems by using Tcl_AttemptAlloc().

FossilOrigin-Name: 1d267757a89d9267ee9c201373f801eb9772ab04
This commit is contained in:
mistachkin 2017-02-15 01:39:28 +00:00
parent 0c5cd969b8
commit dd22c09af8
3 changed files with 13 additions and 9 deletions

View File

@ -1,5 +1,5 @@
C Clarification\sof\sthe\shelp\stext\sfor\sthe\scommand-line\sshell.
D 2017-02-14T21:47:46.389
C In\sthe\sblob\stest\scode,\savoid\scrashing\son\slow-memory\ssystems\sby\susing\sTcl_AttemptAlloc().
D 2017-02-15T01:39:28.000
F Makefile.in edb6bcdd37748d2b1c3422ff727c748df7ffe918
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
F Makefile.msc 067a6766f800cc8d72845ab61f8de4ffe8f3fc99
@ -417,7 +417,7 @@ F src/test_async.c 195ab49da082053fdb0f949c114b806a49ca770a
F src/test_autoext.c 915d245e736652a219a907909bb6710f0d587871
F src/test_backup.c bf5da90c9926df0a4b941f2d92825a01bbe090a0
F src/test_bestindex.c d23f80d334c59662af69191854c76b8d3d0c8c96
F src/test_blob.c 6a4c7920d1d9c6cc0f7aa50c89c4f80016aeda83
F src/test_blob.c f65ac717da2618691cf9dad094e6da0219dcd208
F src/test_btree.c 8b2dc8b8848cf3a4db93f11578f075e82252a274
F src/test_config.c 83179ea845479b5be9a651d014649e3f2722a1fe
F src/test_delete.c af7eab5702f853fb1c62a5f7665e2234cf1ae17b
@ -1555,7 +1555,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 54836270c9c0bfa5910f7ad74ec238b9d7ddee5f
R 81ac83b9aa3d80dbb34372d0527e01bd
U drh
Z 42f594c3c0159a4f4af8ef6e693c76a8
P ca4f1e4962df64ae756c286f3795af7d6f692cdd
R 91e8830a4e86062346b40a8d7a630a58
U mistachkin
Z 631cc99fc676ac52e315c4b1825161e1

View File

@ -1 +1 @@
ca4f1e4962df64ae756c286f3795af7d6f692cdd
1d267757a89d9267ee9c201373f801eb9772ab04

View File

@ -239,7 +239,11 @@ static int SQLITE_TCLAPI test_blob_read(
}
if( nByte>0 ){
zBuf = (unsigned char *)Tcl_Alloc(nByte);
zBuf = (unsigned char *)Tcl_AttemptAlloc(nByte);
if( zBuf==0 ){
Tcl_AppendResult(interp, "out of memory", 0);
return TCL_ERROR;
}
}
rc = sqlite3_blob_read(pBlob, zBuf, nByte, iOffset);
if( rc==SQLITE_OK ){