mirror of
https://github.com/sqlite/sqlite.git
synced 2026-01-06 08:01:16 +03:00
Avoid trying to allocate a negative number of bytes of memory in the test wrapper for sqlite3_blob_read().
FossilOrigin-Name: 739b5d9aa4eaa4191ca512d0dbf94a6bdbb12d97
This commit is contained in:
@@ -1690,7 +1690,7 @@ static int test_blob_read(
|
||||
sqlite3_blob *pBlob;
|
||||
int nByte;
|
||||
int iOffset;
|
||||
unsigned char *zBuf;
|
||||
unsigned char *zBuf = 0;
|
||||
int rc;
|
||||
|
||||
if( objc!=4 ){
|
||||
@@ -1705,7 +1705,9 @@ static int test_blob_read(
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
zBuf = (unsigned char *)Tcl_Alloc(nByte);
|
||||
if( nByte>0 ){
|
||||
zBuf = (unsigned char *)Tcl_Alloc(nByte);
|
||||
}
|
||||
rc = sqlite3_blob_read(pBlob, zBuf, nByte, iOffset);
|
||||
if( rc==SQLITE_OK ){
|
||||
Tcl_SetObjResult(interp, Tcl_NewByteArrayObj(zBuf, nByte));
|
||||
|
||||
Reference in New Issue
Block a user