/ Check-in [4d129bee]
Login

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

Overview
Comment:Fix an error in the malloc.test test script causing a small buffer overread. (CVS 6725)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:4d129bee696f3a537f7ea5501a387012fc08c27e
User & Date: danielk1977 2009-06-06 16:08:23
Context
2009-06-06
19:21
Update the error message on one of the corruption tests to account for the fact that we are finding the corruption sooner. (CVS 6726) check-in: ba9848e7 user: drh tags: trunk
16:08
Fix an error in the malloc.test test script causing a small buffer overread. (CVS 6725) check-in: 4d129bee user: danielk1977 tags: trunk
15:17
Make sure the result of sqlite3VdbeGetOp() is not used as an array following an OOM error, since after (6691) it might be a single-entry dummy opcode. (CVS 6724) check-in: 127b1398 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to test/malloc.test.

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
...
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
# This file attempts to check the behavior of the SQLite library in 
# an out-of-memory situation. When compiled with -DSQLITE_DEBUG=1, 
# the SQLite library accepts a special command (sqlite3_memdebug_fail N C)
# which causes the N-th malloc to fail.  This special feature is used
# to see what happens in the library if a malloc were to really fail
# due to an out-of-memory situation.
#
# $Id: malloc.test,v 1.78 2009/04/09 01:23:49 drh Exp $

set testdir [file dirname $argv0]
source $testdir/tester.tcl


# Only run these tests if memory debugging is turned on.
#
................................................................................
    set ::STMT [sqlite3_prepare db $sql -1 X]
    sqlite3_step $::STMT
    if { $::tcl_platform(byteOrder)=="littleEndian" } {
      set ::bomstr "\xFF\xFE"
    } else {
      set ::bomstr "\xFE\xFF"
    }
    append ::bomstr [encoding convertto unicode "123456789_123456789_12345678"]
  } -tclbody {
    sqlite3_column_text16 $::STMT 0
    sqlite3_column_int $::STMT 0
    sqlite3_column_text16 $::STMT 1
    sqlite3_column_double $::STMT 1
    set rc [sqlite3_reset $::STMT]
    if {$rc eq "SQLITE_NOMEM"} {error "out of memory"}







|







 







|







12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
...
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
# This file attempts to check the behavior of the SQLite library in 
# an out-of-memory situation. When compiled with -DSQLITE_DEBUG=1, 
# the SQLite library accepts a special command (sqlite3_memdebug_fail N C)
# which causes the N-th malloc to fail.  This special feature is used
# to see what happens in the library if a malloc were to really fail
# due to an out-of-memory situation.
#
# $Id: malloc.test,v 1.79 2009/06/06 16:08:23 danielk1977 Exp $

set testdir [file dirname $argv0]
source $testdir/tester.tcl


# Only run these tests if memory debugging is turned on.
#
................................................................................
    set ::STMT [sqlite3_prepare db $sql -1 X]
    sqlite3_step $::STMT
    if { $::tcl_platform(byteOrder)=="littleEndian" } {
      set ::bomstr "\xFF\xFE"
    } else {
      set ::bomstr "\xFE\xFF"
    }
    append ::bomstr [encoding convertto unicode "123456789_123456789_123456789"]
  } -tclbody {
    sqlite3_column_text16 $::STMT 0
    sqlite3_column_int $::STMT 0
    sqlite3_column_text16 $::STMT 1
    sqlite3_column_double $::STMT 1
    set rc [sqlite3_reset $::STMT]
    if {$rc eq "SQLITE_NOMEM"} {error "out of memory"}