OLD | NEW |
1 # 2004 August 30 | 1 # 2004 August 30 |
2 # | 2 # |
3 # The author disclaims copyright to this source code. In place of | 3 # The author disclaims copyright to this source code. In place of |
4 # a legal notice, here is a blessing: | 4 # a legal notice, here is a blessing: |
5 # | 5 # |
6 # May you do good and not evil. | 6 # May you do good and not evil. |
7 # May you find forgiveness for yourself and forgive others. | 7 # May you find forgiveness for yourself and forgive others. |
8 # May you share freely, never taking more than you give. | 8 # May you share freely, never taking more than you give. |
9 # | 9 # |
10 #*********************************************************************** | 10 #*********************************************************************** |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 forcecopy test.bu test.db | 93 forcecopy test.bu test.db |
94 | 94 |
95 # insert corrupt byte(s) | 95 # insert corrupt byte(s) |
96 hexio_write test.db 2053 [format %02x 0x04] | 96 hexio_write test.db 2053 [format %02x 0x04] |
97 | 97 |
98 sqlite3 db test.db | 98 sqlite3 db test.db |
99 catchsql {PRAGMA integrity_check} | 99 catchsql {PRAGMA integrity_check} |
100 } {1 {database disk image is malformed}} | 100 } {1 {database disk image is malformed}} |
101 | 101 |
102 # test that a corrupt content offset size is handled (seed 5649) | 102 # test that a corrupt content offset size is handled (seed 5649) |
| 103 # |
| 104 # Update 2016-12-27: As of check-in [0b86fbca66] "In sqlite3BtreeInsert() when |
| 105 # replacing a re-existing row, try to overwrite the cell directly rather than |
| 106 # deallocate and reallocate the cell" on 2016-12-09, this test case no longer |
| 107 # detects the offset size problem during the UPDATE. We have to run a subsequen
t |
| 108 # integrity_check to see it. |
103 do_test corruptC-2.2 { | 109 do_test corruptC-2.2 { |
104 db close | 110 db close |
105 forcecopy test.bu test.db | 111 forcecopy test.bu test.db |
106 | 112 |
107 # insert corrupt byte(s) | 113 # insert corrupt byte(s) |
108 hexio_write test.db 27 [format %02x 0x08] | 114 hexio_write test.db 27 [format %02x 0x08] |
109 hexio_write test.db 233 [format %02x 0x6a] | 115 hexio_write test.db 233 [format %02x 0x6a] |
110 hexio_write test.db 328 [format %02x 0x67] | 116 hexio_write test.db 328 [format %02x 0x67] |
111 hexio_write test.db 750 [format %02x 0x1f] | 117 hexio_write test.db 750 [format %02x 0x1f] |
112 hexio_write test.db 1132 [format %02x 0x52] | 118 hexio_write test.db 1132 [format %02x 0x52] |
113 hexio_write test.db 1133 [format %02x 0x84] | 119 hexio_write test.db 1133 [format %02x 0x84] |
114 hexio_write test.db 1220 [format %02x 0x01] | 120 hexio_write test.db 1220 [format %02x 0x01] |
115 hexio_write test.db 3688 [format %02x 0xc1] | 121 hexio_write test.db 3688 [format %02x 0xc1] |
116 hexio_write test.db 3714 [format %02x 0x58] | 122 hexio_write test.db 3714 [format %02x 0x58] |
117 hexio_write test.db 3746 [format %02x 0x9a] | 123 hexio_write test.db 3746 [format %02x 0x9a] |
118 | 124 |
119 sqlite3 db test.db | 125 sqlite3 db test.db |
120 catchsql {UPDATE t1 SET y=1} | 126 db eval {UPDATE t1 SET y=1} |
121 } {1 {database disk image is malformed}} | 127 db eval {PRAGMA integrity_check} |
| 128 } {/Offset .* out of range/} |
122 | 129 |
123 # test that a corrupt free cell size is handled (seed 13329) | 130 # test that a corrupt free cell size is handled (seed 13329) |
124 do_test corruptC-2.3 { | 131 do_test corruptC-2.3 { |
125 db close | 132 db close |
126 forcecopy test.bu test.db | 133 forcecopy test.bu test.db |
127 | 134 |
128 # insert corrupt byte(s) | 135 # insert corrupt byte(s) |
129 hexio_write test.db 1094 [format %02x 0x76] | 136 hexio_write test.db 1094 [format %02x 0x76] |
130 | 137 |
131 sqlite3 db test.db | 138 sqlite3 db test.db |
(...skipping 18 matching lines...) Expand all Loading... |
150 forcecopy test.bu test.db | 157 forcecopy test.bu test.db |
151 | 158 |
152 # insert corrupt byte(s) | 159 # insert corrupt byte(s) |
153 hexio_write test.db 3119 [format %02x 0xdf] | 160 hexio_write test.db 3119 [format %02x 0xdf] |
154 hexio_write test.db 4073 [format %02x 0xbf] | 161 hexio_write test.db 4073 [format %02x 0xbf] |
155 | 162 |
156 sqlite3 db test.db | 163 sqlite3 db test.db |
157 catchsql {BEGIN; UPDATE t2 SET y='abcdef-uvwxyz'; ROLLBACK;} | 164 catchsql {BEGIN; UPDATE t2 SET y='abcdef-uvwxyz'; ROLLBACK;} |
158 catchsql {PRAGMA integrity_check} | 165 catchsql {PRAGMA integrity_check} |
159 } {0 {{*** in database main *** | 166 } {0 {{*** in database main *** |
160 Page 4: btreeInitPage() returns error code 11}}} | 167 On tree page 4 cell 19: Extends off end of page}}} |
161 | 168 |
162 # {0 {{*** in database main *** | 169 # {0 {{*** in database main *** |
163 # Corruption detected in cell 710 on page 4 | 170 # Corruption detected in cell 710 on page 4 |
164 # Multiple uses for byte 661 of page 4 | 171 # Multiple uses for byte 661 of page 4 |
165 # Fragmented space is 249 byte reported as 21 on page 4}}} | 172 # Fragmented space is 249 byte reported as 21 on page 4}}} |
166 | 173 |
167 # test that a corrupt free cell size is handled (seed 169595) | 174 # test that a corrupt free cell size is handled (seed 169595) |
168 do_test corruptC-2.6 { | 175 do_test corruptC-2.6 { |
169 db close | 176 db close |
170 forcecopy test.bu test.db | 177 forcecopy test.bu test.db |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 set stats(ref) | 418 set stats(ref) |
412 } {0} | 419 } {0} |
413 } | 420 } |
414 } | 421 } |
415 # end for i | 422 # end for i |
416 | 423 |
417 } | 424 } |
418 # end for tn | 425 # end for tn |
419 | 426 |
420 finish_test | 427 finish_test |
OLD | NEW |