Fix an assert() failure in sqlite3recover.c.

FossilOrigin-Name: f52bb19281b189508f5c31305cbd4a5651f3e036a4ee753c64488b0c7e5d2e4d
This commit is contained in:
dan 2024-11-08 20:44:16 +00:00
parent 4441897daa
commit 23cfa0138e
4 changed files with 64 additions and 10 deletions

View File

@ -525,7 +525,6 @@ do_test 7.1 {
} {1 {file is not a database}} } {1 {file is not a database}}
reset_db reset_db
breakpoint
do_test 8.0 { do_test 8.0 {
sqlite3 db {} sqlite3 db {}
db deserialize [decode_hexdb { db deserialize [decode_hexdb {
@ -552,5 +551,58 @@ do_test 8.1 {
list [catch { $R finish } msg] $msg list [catch { $R finish } msg] $msg
} {0 {}} } {0 {}}
reset_db
do_test 9.0 {
sqlite3 db {}
db deserialize [decode_hexdb {
| size 16384 pagesize 4096t 0
| 0: 53 51 4c 69 74 65 20 66 6f 72 6d 61 74 20 33 00
| 16: 10 00 01 01 00 40 20 20 00 00 00 00 00 00 00 06 ........
| 32: 00 00 00 0r 00 00 00 00 00 00 00 06 00 00 00 04 ..
| 48: 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 ........
| 96: 00 00 00 00 0d 00 00 00 06 0d e2 00 0f c4 0f 6a .......j
| 112: 0e fc 0e 9d 0e 3d 0d e2 00 00 00 00 00 00 00 00 .
| 3552: 00 00 59 06 06 17 21 21 01 7f 74 61 62 6c 65 74 ..tablet
| 3568: 74 74 5f 63 6f 6e 66 69 67 74 74 74 5f 63 6f 6econ
| 3584: 66 69 67 06 43 52 45 41 54 45 20 54 41 42 4c 45
| 3616: 50 52 49 4d 41 52 59 20 4b 45 59 2c 20 76 29 20 )
| 3632: 57 49 54 48 4f 55 54 20 52 4f 57 49 44 5e 05 07 WOWID^..
| 3648: 17 23 23 01 81 03 74 61 62 6c 65 74 74 74 5f 6tt_d
| 3664: 6f 63 73 69 7a 65 74 74 74 5f 64 6f 63 73 69 7a z
| 3680: 65 05 43 52 45 41 54 45 20 54 41 42 4c 45 20 27 e.ABLE '
| 3696: 74 74 74 5f 64 6f 63 73 69 7a 65 27 28 69 64 20id
| 3712: 49 4e 54 45 47 45 52 20 50 52 49 4d 41 52 59 20
| 3728: 4b 45 59 2c 20 73 7a 20 42 4c 4f 42 29 5d 04 07 KEYB)]..
| 3744: 17 23 23 01 81 B1 74 61 62 6c 65 74 74 74 5f 63 _c
| 3760: 6f 6e 74 65 6e 74 74 74 74 5f 63 6f 6e 74 65 6e o_conten
| 3776: 7 04 01 03 00 011 54 45 20 54 41 42 4c 45 20 27 t.CRLE '
| 3792: 74 74 74 5f 63 6f 6e 74 65 6e 74 27 28 69 64 20
| 3808: 49 4e 54 45 47 45 52 20 50 52 49 4d 41 52 59 20 INIMARY
| 3904: 6f 2c 20 50 52 49 4d 41 52 59 20 4b 45 59 28 7EY(s
| 3920: 65 67 69 64 2c 20 74 65 72 6d 29 29 20 57 49 54 T
| 3936: 48 4f 55 54 20 52 4f 57 49 4 58 58 02 07 17 1d 1d ..
| 3952: 01 81 03 74 61 62 6c 65 74 74 74 5f 64 61 74 61 .tt_data
| 3968: 74 74 74 5f 64 61 74 61 02 43 52 45 41 54 45 2ATE
| 3984: 54 41 42 4c 45 20 27 74 74 74 5f 64 61 74 61 27 '
| 4000: 28 69 64 20 49 4e 54 45 47 45 52 20 50 52 49 4d (iR PRIM
| 4016: 41 52 59 20 4b 45 59 2c 20 62 6c 6f 63 6b 20 42k B
| 4032: 4c 4f 42 29 3a 01 06 17 13 13 08 5f 74 61 62 6c
| 4048: 65 74 74 74 74 74 74 43 52 45 41 54 45 20 56 49 ettTE VI
| 4064: 52 54 55 41 4c 20 54 41 42 4c 45 20 74 74 74 20 t
| 4080: 55 53 49 4e 47 20 66 74 73 35 28 61 2c 20 62 29 U5(a, b)
| page 4 offset 12288
| 0: 0a 00 00 00 03 0f ea 00 0f fa 0f f2 0f ea 00 00 ........
| 4064: 00 00 00 00 00 00 00 00 00 00 07 04 01 01 01 05 ..
| 4080: 06 03 07 04 01 01 01 03 04 02 05 04 09 01 09 02 ........
| end ro2.t
}]} {}
do_test 9.1 {
set R [sqlite3_recover_init db main test.db2]
catch { $R run }
list [catch { $R finish } msg] $msg
} {0 {}}
finish_test finish_test

View File

@ -1825,6 +1825,8 @@ static int recoverWriteDataStep(sqlite3_recover *p){
recoverError(p, SQLITE_NOMEM, 0); recoverError(p, SQLITE_NOMEM, 0);
} }
p1->nVal = iField+1; p1->nVal = iField+1;
}else if( pTab->nCol==0 ){
p1->nVal = pTab->nCol;
} }
p1->iPrevCell = iCell; p1->iPrevCell = iCell;
p1->iPrevPage = iPage; p1->iPrevPage = iPage;

View File

@ -1,5 +1,5 @@
C Remove\sone\sdep\sfrom\s.tclenv.sh\swhich\sis\sonly\svalid\sfor\sconfigure-driven\sbuilds,\snot\sstatic\smakefiles. C Fix\san\sassert()\sfailure\sin\ssqlite3recover.c.
D 2024-11-08T14:34:33.911 D 2024-11-08T20:44:16.924
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d
@ -512,7 +512,7 @@ F ext/recover/recover_common.tcl a61306c1eb45c0c3fc45652c35b2d4ec19729e340bdf65a
F ext/recover/recoverbuild.test c74170e0f7b02456af41838afeb5353fdb985a48cc2331d661bbabbca7c6b8e3 F ext/recover/recoverbuild.test c74170e0f7b02456af41838afeb5353fdb985a48cc2331d661bbabbca7c6b8e3
F ext/recover/recoverclobber.test 3ba6c0c373c5c63d17e82eced64c05c57ccaf26c1abe1ca7141334022a79f32e F ext/recover/recoverclobber.test 3ba6c0c373c5c63d17e82eced64c05c57ccaf26c1abe1ca7141334022a79f32e
F ext/recover/recovercorrupt.test 64c081ad1200ae77b447da99eb724785d6bf71715f394543dc7689642e92bf49 F ext/recover/recovercorrupt.test 64c081ad1200ae77b447da99eb724785d6bf71715f394543dc7689642e92bf49
F ext/recover/recovercorrupt2.test 1418f1710debc24ff38276cedfcea234beb37a34205708e7e3e6d76cc4a979db F ext/recover/recovercorrupt2.test 7347ccc9c36a925d99b56689c791423b45294834198f17575183fd500f52d85d
F ext/recover/recovercorrupt3.test 2e7b9a1b528ca23ed382cec6f64e3fcbbd0f8e852add7562397fd8df83f335d5 F ext/recover/recovercorrupt3.test 2e7b9a1b528ca23ed382cec6f64e3fcbbd0f8e852add7562397fd8df83f335d5
F ext/recover/recovercorrupt4.test 3e2794145dad2517c018cb68b96f59d4d55b18b3d6271e1d37852cfd7a30b50c F ext/recover/recovercorrupt4.test 3e2794145dad2517c018cb68b96f59d4d55b18b3d6271e1d37852cfd7a30b50c
F ext/recover/recoverfault.test 9d9f88eeb222615a25e7514f234c950d46bee20d24cd8db49d8fff8d650dcfe1 F ext/recover/recoverfault.test 9d9f88eeb222615a25e7514f234c950d46bee20d24cd8db49d8fff8d650dcfe1
@ -522,7 +522,7 @@ F ext/recover/recoverpgsz.test 88766fcb810e52ee05335c456d4e5fb06d02b73d3ccb48c52
F ext/recover/recoverrowid.test f948bf4024a5f41b0e21b8af80c60564c5b5d78c05a8d64fc00787715ff9f45f F ext/recover/recoverrowid.test f948bf4024a5f41b0e21b8af80c60564c5b5d78c05a8d64fc00787715ff9f45f
F ext/recover/recoverslowidx.test 5205a9742dd9490ee99950dabb622307355ef1662dea6a3a21030057bfd81411 F ext/recover/recoverslowidx.test 5205a9742dd9490ee99950dabb622307355ef1662dea6a3a21030057bfd81411
F ext/recover/recoversql.test e66d01f95302a223bcd3fd42b5ee58dc2b53d70afa90b0d00e41e4b8eab20486 F ext/recover/recoversql.test e66d01f95302a223bcd3fd42b5ee58dc2b53d70afa90b0d00e41e4b8eab20486
F ext/recover/sqlite3recover.c e822ecbb05a04a5c85d1309765fcd6cf392d100d02d2227cd7720c9d6921a17a F ext/recover/sqlite3recover.c 788438a6735108d14ca82cf39c59abf8cde2ee384b962fb93e975eb24f2732fe
F ext/recover/sqlite3recover.h 011c799f02deb70ab685916f6f538e6bb32c4e0025e79bfd0e24ff9c74820959 F ext/recover/sqlite3recover.h 011c799f02deb70ab685916f6f538e6bb32c4e0025e79bfd0e24ff9c74820959
F ext/recover/test_recover.c 072260d7452a3b81aba995b2b3269e7ec2aa7f06725544ba4c25b1b0a1dbc61a F ext/recover/test_recover.c 072260d7452a3b81aba995b2b3269e7ec2aa7f06725544ba4c25b1b0a1dbc61a
F ext/repair/README.md 92f5e8aae749a4dae14f02eea8e1bb42d4db2b6ce5e83dbcdd6b1446997e0c15 F ext/repair/README.md 92f5e8aae749a4dae14f02eea8e1bb42d4db2b6ce5e83dbcdd6b1446997e0c15
@ -2201,8 +2201,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350
F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7
F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
P 1bd9de719b0944fdceec32103da3131a7d387820850ab03f652f813d840355b8 P 22986767da8f086daaa6dc760c15e6aedcc5d2d6033937ac2f112ee5750d7fdb
R 893eb86bb8e20c86cb402dee09f37203 R 6e0cc6db960e922136e512712813d155
U stephan U dan
Z 6964dc53af456b95e9c89bd288941f5a Z fa49496fb1b74fa0bc26b3e4367b5508
# Remove this line to create a well-formed Fossil manifest. # Remove this line to create a well-formed Fossil manifest.

View File

@ -1 +1 @@
22986767da8f086daaa6dc760c15e6aedcc5d2d6033937ac2f112ee5750d7fdb f52bb19281b189508f5c31305cbd4a5651f3e036a4ee753c64488b0c7e5d2e4d