Added test cases for corrupt 2-10 byte SerialTypeLen values. (CVS 5140)

FossilOrigin-Name: 97ed2dd1dc9d8e8f837914277c080160d319591b
This commit is contained in:
shane 2008-05-19 15:37:10 +00:00
parent 2d1a8d2fe6
commit 8ef4263135
3 changed files with 119 additions and 11 deletions

View File

@ -1,5 +1,5 @@
C Disable\sthe\scolumn\scache\swhen\scoding\svalues\sthat\swill\sbe\spassed\sto\sthe\sxFilter()\smethod\sof\sa\svirtual\stable,\sin\scase\sthe\sxFilter()\simplementation\smodifies\sthe\stype\sor\sencoding\sof\sthe\svalue.\sTicket\s#3121.\s(CVS\s5139) C Added\stest\scases\sfor\scorrupt\s2-10\sbyte\sSerialTypeLen\svalues.\s(CVS\s5140)
D 2008-05-16T15:40:40 D 2008-05-19T15:37:10
F Makefile.arm-wince-mingw32ce-gcc ac5f7b2cef0cd850d6f755ba6ee4ab961b1fadf7 F Makefile.arm-wince-mingw32ce-gcc ac5f7b2cef0cd850d6f755ba6ee4ab961b1fadf7
F Makefile.in 79aeba12300a54903f1b1257c1e7c190234045dd F Makefile.in 79aeba12300a54903f1b1257c1e7c190234045dd
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@ -233,7 +233,7 @@ F test/corrupt2.test 8059c7354aaba91e7405b4503b79f456c816df8e
F test/corrupt3.test 263e8bb04e2728df832fddf6973cf54c91db0c32 F test/corrupt3.test 263e8bb04e2728df832fddf6973cf54c91db0c32
F test/corrupt4.test acdb01afaedf529004b70e55de1a6f5a05ae7fff F test/corrupt4.test acdb01afaedf529004b70e55de1a6f5a05ae7fff
F test/corrupt5.test 7796d5bdfe155ed824cee9dff371f49da237cfe0 F test/corrupt5.test 7796d5bdfe155ed824cee9dff371f49da237cfe0
F test/corrupt6.test 9c32c74e41a6c9c2964bad75dca3785f956e556a F test/corrupt6.test e69b877d478224deab7b66844566258cecacd25e
F test/crash.test 1b6ac8410689ff78028887f445062dc897c9ac89 F test/crash.test 1b6ac8410689ff78028887f445062dc897c9ac89
F test/crash2.test 26d7a4c5520201e5de2c696ea51ab946b59dc0e9 F test/crash2.test 26d7a4c5520201e5de2c696ea51ab946b59dc0e9
F test/crash3.test 0b09687ae1a3ccbcefdfaeb4b963e26e36255d76 F test/crash3.test 0b09687ae1a3ccbcefdfaeb4b963e26e36255d76
@ -636,7 +636,7 @@ F www/tclsqlite.tcl 8be95ee6dba05eabcd27a9d91331c803f2ce2130
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5 F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5
P e94a2883060b9ef59809ff4de9525d897d95546c P ecbc0d5deddc0ca0d1d2649e0134ee392266027e
R d8ea57ad8afa02e143de5e2bb345621f R 37a7c25321c7791c1c14cbcefeac56a4
U danielk1977 U shane
Z daf8d2ef2b1e508dc6f926c2aac99473 Z 4ca6a78c8e149d07dae4e73975b338da

View File

@ -1 +1 @@
ecbc0d5deddc0ca0d1d2649e0134ee392266027e 97ed2dd1dc9d8e8f837914277c080160d319591b

View File

@ -14,7 +14,7 @@
# segfault if it sees a corrupt database file. It specifically focuses # segfault if it sees a corrupt database file. It specifically focuses
# on corrupt SerialTypeLen values. # on corrupt SerialTypeLen values.
# #
# $Id: corrupt6.test,v 1.1 2008/05/07 18:59:29 shane Exp $ # $Id: corrupt6.test,v 1.2 2008/05/19 15:37:10 shane Exp $
set testdir [file dirname $argv0] set testdir [file dirname $argv0]
source $testdir/tester.tcl source $testdir/tester.tcl
@ -55,10 +55,10 @@ integrity_check corrupt6-1.4
# SerialTypeLen = (len*2+12) = 60*2+12 = 132 # SerialTypeLen = (len*2+12) = 60*2+12 = 132
do_test corrupt6-1.5.1 { do_test corrupt6-1.5.1 {
hexio_read test.db 1923 2 hexio_read test.db 1923 2
} 8103 ;# First text field size if 81 03 == 131 } 8103 ;# First text field size is 81 03 == 131
do_test corrupt6-1.5.2 { do_test corrupt6-1.5.2 {
hexio_read test.db 1987 2 hexio_read test.db 1987 2
} 8103 ;# Second text field size if 81 03 == 131 } 8103 ;# Second text field size is 81 03 == 131
# Verify simple query results as expected. # Verify simple query results as expected.
do_test corrupt6-1.6 { do_test corrupt6-1.6 {
@ -140,4 +140,112 @@ do_test corrupt6-1.9.3 {
} [list 0 {varint32 varint32} ] } [list 0 {varint32 varint32} ]
integrity_check corrupt6-1.9.4 integrity_check corrupt6-1.9.4
# Adjust value of record 1 / field 1 SerialTypeLen and see if the
# corruption is detected.
# Set SerialTypeLen to FF 7F (2 bytes)
do_test corrupt6-1.10.1 {
db close
hexio_write test.db 1923 FF7F
sqlite3 db test.db
catchsql {
SELECT substr(x,1,8) FROM t1
}
} [list 1 {database disk image is malformed}]
# Adjust value of record 1 / field 1 SerialTypeLen and see if the
# corruption is detected.
# Set SerialTypeLen to FF FF 7F (3 bytes)
do_test corrupt6-1.10.2 {
db close
hexio_write test.db 1923 FFFF7F
sqlite3 db test.db
catchsql {
SELECT substr(x,1,8) FROM t1
}
} [list 1 {database disk image is malformed}]
# Adjust value of record 1 / field 1 SerialTypeLen and see if the
# corruption is detected.
# Set SerialTypeLen to FF FF FF 7F (4 bytes)
do_test corrupt6-1.10.3 {
db close
hexio_write test.db 1923 FFFFFF7F
sqlite3 db test.db
catchsql {
SELECT substr(x,1,8) FROM t1
}
} [list 1 {database disk image is malformed}]
# Adjust value of record 1 / field 1 SerialTypeLen and see if the
# corruption is detected.
# Set SerialTypeLen to FF FF FF FF 7F (5 bytes)
do_test corrupt6-1.10.4 {
db close
hexio_write test.db 1923 FFFFFFFF7F
sqlite3 db test.db
catchsql {
SELECT substr(x,1,8) FROM t1
}
} [list 1 {database disk image is malformed}]
# Adjust value of record 1 / field 1 SerialTypeLen and see if the
# corruption is detected.
# Set SerialTypeLen to FF FF FF FF FF 7F (6 bytes, and overflows).
do_test corrupt6-1.10.5 {
db close
hexio_write test.db 1923 FFFFFFFFFF7F
sqlite3 db test.db
catchsql {
SELECT substr(x,1,8) FROM t1
}
} [list 1 {database disk image is malformed}]
# Adjust value of record 1 / field 1 SerialTypeLen and see if the
# corruption is detected.
# Set SerialTypeLen to FF FF FF FF FF FF 7F (7 bytes, and overflows).
do_test corrupt6-1.10.6 {
db close
hexio_write test.db 1923 FFFFFFFFFFFF7F
sqlite3 db test.db
catchsql {
SELECT substr(x,1,8) FROM t1
}
} [list 1 {database disk image is malformed}]
# Adjust value of record 1 / field 1 SerialTypeLen and see if the
# corruption is detected.
# Set SerialTypeLen to FF FF FF FF FF FF FF 7F (8 bytes, and overflows).
do_test corrupt6-1.10.7 {
db close
hexio_write test.db 1923 FFFFFFFFFFFFFF7F
sqlite3 db test.db
catchsql {
SELECT substr(x,1,8) FROM t1
}
} [list 1 {database disk image is malformed}]
# Adjust value of record 1 / field 1 SerialTypeLen and see if the
# corruption is detected.
# Set SerialTypeLen to FF FF FF FF FF FF FF FF 7F (9 bytes, and overflows).
do_test corrupt6-1.10.8 {
db close
hexio_write test.db 1923 FFFFFFFFFFFFFFFF7F
sqlite3 db test.db
catchsql {
SELECT substr(x,1,8) FROM t1
}
} [list 1 {database disk image is malformed}]
# Adjust value of record 1 / field 1 SerialTypeLen and see if the
# corruption is detected.
# Set SerialTypeLen to FFFF FF FF FF FF FF FF FF 7F (10 bytes, and overflows).
do_test corrupt6-1.10.9 {
db close
hexio_write test.db 1923 FFFFFFFFFFFFFFFFFF7F
sqlite3 db test.db
catchsql {
SELECT substr(x,1,8) FROM t1
}
} [list 1 {database disk image is malformed}]
finish_test finish_test