SQLite

Check-in [f483d06a9a]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Handle a real OOM condition when incrblob2.test is run on a low-memory machine.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: f483d06a9af8d6771090551d911831e1df13bb05a6b7780499594703c28ebbb2
User & Date: drh 2017-07-24 17:37:35.310
Context
2017-07-24
19:25
Do not attempt to run test file unionvtab.test with SQLITE_OMIT_VIRTUAL_TABLE builds. (check-in: 9a5a3d60a5 user: dan tags: trunk)
17:37
Handle a real OOM condition when incrblob2.test is run on a low-memory machine. (check-in: f483d06a9a user: drh tags: trunk)
15:29
Additional documentation on sqlite3_bind_pointer() and sqlite3_result_pointer(). No changes to code. (check-in: b1572d4e05 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/test_blob.c.
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
  ){ 
    return TCL_ERROR;
  }

  if( nByte>0 ){
    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 ){
    Tcl_SetObjResult(interp, Tcl_NewByteArrayObj(zBuf, nByte));
  }else{







|







237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
  ){ 
    return TCL_ERROR;
  }

  if( nByte>0 ){
    zBuf = (unsigned char *)Tcl_AttemptAlloc(nByte);
    if( zBuf==0 ){
      Tcl_AppendResult(interp, "out of memory in " __FILE__, 0);
      return TCL_ERROR;
    }
  }
  rc = sqlite3_blob_read(pBlob, zBuf, nByte, iOffset);
  if( rc==SQLITE_OK ){
    Tcl_SetObjResult(interp, Tcl_NewByteArrayObj(zBuf, nByte));
  }else{
Changes to test/incrblob2.test.
327
328
329
330
331
332
333



334
335
336
337
338
339
340
if {$::tcl_platform(pointerSize)>=8} {
  do_test incrblob2-6.2b {
    set rc [catch {
      # Prior to 2015-02-07, the following caused a segfault due to
      # integer overflow.
      sqlite3_blob_read $rdHandle 2147483647 2147483647
    } errmsg]



    lappend rc $errmsg
  } {1 SQLITE_ERROR}
}
do_test incrblob2-6.2c {
  set rc [catch {
    # Prior to 2015-02-07, the following caused a segfault due to
    # integer overflow.







>
>
>







327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
if {$::tcl_platform(pointerSize)>=8} {
  do_test incrblob2-6.2b {
    set rc [catch {
      # Prior to 2015-02-07, the following caused a segfault due to
      # integer overflow.
      sqlite3_blob_read $rdHandle 2147483647 2147483647
    } errmsg]
    if {[string match {out of memory in *test_blob.c} $errmsg]} {
      set errmsg SQLITE_ERROR
    }
    lappend rc $errmsg
  } {1 SQLITE_ERROR}
}
do_test incrblob2-6.2c {
  set rc [catch {
    # Prior to 2015-02-07, the following caused a segfault due to
    # integer overflow.