Fix a problem in the new code introduced by [658b84d7] causing corruption and other errors to be ignored.

FossilOrigin-Name: 7ccf2e7d413adb109c61456a5f46e87d38884801dbaab93297a17e3050014b59
This commit is contained in:
dan 2019-05-09 11:19:27 +00:00
parent eb265343a9
commit 873b019826
4 changed files with 153 additions and 10 deletions

View File

@ -1,5 +1,5 @@
C Ensure\sthat\sthe\ssqlite3BtreeLast()\sinterface\sinitializes\sthe\s*pRes\sreturn\nto\szero\sif\sthe\scursor\sis\salready\ssitting\son\sthe\slast\sentry\sof\sthe\stable.
D 2019-05-08T23:55:04.921
C Fix\sa\sproblem\sin\sthe\snew\scode\sintroduced\sby\s[658b84d7]\scausing\scorruption\sand\sother\serrors\sto\sbe\signored.
D 2019-05-09T11:19:27.227
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@ -593,7 +593,7 @@ F src/upsert.c 0dd81b40206841814d46942a7337786932475f085716042d0cb2fc7791bf8ca4
F src/utf.c 2f0fac345c7660d5c5bd3df9e9d8d33d4c27f366bcfb09e07443064d751a0507
F src/util.c 5061987401c2e8003177fa30d73196aa036727c8f04bf36a2df0c82b1904a236
F src/vacuum.c 82dcec9e7b1afa980288718ad11bc499651c722d7b9f32933c4d694d91cb6ebf
F src/vdbe.c 02d6df64c03e6c69b94d8e53699b0ab4e4d6bc74ef88484b48970864dbf0cce7
F src/vdbe.c 5612b064d4c5d59efa0be7209ba8b631a534b16cebc63f2899eb887505dfcf2f
F src/vdbe.h 712bca562eaed1c25506b9faf9680bdc75fc42e2f4a1cd518d883fa79c7a4237
F src/vdbeInt.h 3ba14553508d66f58753952d6dd287dce4ec735de02c6440858b4891aed51c17
F src/vdbeapi.c f9161e5c77f512fbb80091ce8af621d19c9556bda5e734cffaac1198407400da
@ -765,7 +765,7 @@ F test/corruptH.test 79801d97ec5c2f9f3c87739aa1ec2eb786f96454
F test/corruptI.test a17bbf54fdde78d43cf3cc34b0057719fd4a173a3d824285b67dc5257c064c7b
F test/corruptJ.test 4d5ccc4bf959464229a836d60142831ef76a5aa4
F test/corruptK.test 5b4212fe346699831c5ad559a62c54e11c0611bdde1ea8423a091f9c01aa32af
F test/corruptL.test 13763e4769eeef308badfcc95dea5d5e00e61a1732a1214a48ff24d3f5db8cbc
F test/corruptL.test b6ea0f657b26a8fe10405a9f5970f94de47fdfcc02fce2a635954aef13e55a88
F test/cost.test 51f4fcaae6e78ad5a57096831259ed6c760e2ac6876836e91c00030fad385b34
F test/count.test cb2e0f934c6eb33670044520748d2ecccd46259c
F test/countofview.test e3d4cd6900e4e4f074968ab24b8b87d3671cd624961bef40fd3a6b8f574343cf
@ -1825,7 +1825,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P 51d32173ff1f610b5d75a50f20fa1e0e4e22046299869e3b82e0bb446dba890c
R 18700b334a433dab3b562877ac4a0a65
U drh
Z f8fe35a5ae505a0883dbd5eaecee59b1
P ebe4845cd0ffb96b30be3c69eb399d58e93149886bc2fa60a7ebd7b4fbe447a4
R e44f7e65f3b14237b84a8559c540124d
U dan
Z 0f9cf99179363aae6d38e9c8478ef975

View File

@ -1 +1 @@
ebe4845cd0ffb96b30be3c69eb399d58e93149886bc2fa60a7ebd7b4fbe447a4
7ccf2e7d413adb109c61456a5f46e87d38884801dbaab93297a17e3050014b59

View File

@ -4016,7 +4016,8 @@ case OP_SeekGT: { /* jump, in3, group */
VdbeBranchTaken(1,2); goto jump_to_p2;
break;
}else{
sqlite3BtreeLast(pC->uc.pCursor, &res);
rc = sqlite3BtreeLast(pC->uc.pCursor, &res);
if( rc!=SQLITE_OK ) goto abort_due_to_error;
goto seek_not_found;
}
}else

View File

@ -866,4 +866,146 @@ do_execsql_test 9.3 {
ROLLBACK TO one;
}
#-------------------------------------------------------------------------
reset_db
do_test 10.0 {
sqlite3 db {}
db deserialize [decode_hexdb {
| size 180224 pagesize 4096 filename crash-41390d95d613b6.db
| page 1 offset 0
| 0: 53 51 4c 69 74 65 20 66 6f 72 6d 61 74 20 33 00 SQLite format 3.
| 16: 10 00 01 01 00 40 20 20 00 00 00 00 00 00 00 00 .....@ ........
| 96: 00 00 00 00 0d 00 00 00 04 0e e2 00 0f 96 0f 44 ...............D
| 112: 0f 10 0e e2 00 00 00 00 00 00 00 00 00 00 00 00 ................
| 3808: 00 00 2c 14 06 17 15 11 01 41 69 6e 64 65 78 74 ..,......Aindext
| 3824: 41 78 33 74 31 06 43 52 45 41 54 45 20 49 4e 44 Ax3t1.CREATE IND
| 3840: 45 58 20 74 31 78 32 20 4f 4e 20 74 31 28 62 29 EX t1x2 ON t1(b)
| 3856: 32 03 06 17 15 11 01 4d 69 6e 64 65 78 74 31 88 2......Mindext1.
| 3872: 31 74 31 05 43 52 45 41 54 45 20 49 4e 44 45 58 1t1.CREATE INDEX
| 3888: 20 74 31 78 31 20 4f 4e 20 74 31 28 67 2b 68 2c t1x1 ON t1(g+h,
| 3904: 6a 2d 6b 29 50 02 06 17 2b 2b 01 59 74 61 62 6c j-k)P...++.Ytabl
| 3920: 65 73 71 6c 69 74 65 5e 73 65 71 74 65 6e 63 65 esqlite^seqtence
| 3936: 73 71 6c 69 74 65 5f 73 65 71 75 65 6e 63 65 04 sqlite_sequence.
| 3952: 43 52 45 41 54 45 20 54 41 42 4c 45 20 73 71 6c CREATE TABLE sql
| 3968: 69 74 65 5f 73 65 71 75 65 6e 63 65 28 6e 61 6d ite_sequence(nam
| 3984: 65 2c 73 65 71 29 68 00 07 17 11 11 01 81 3b 74 e,seq)h.......;t
| 4000: 61 62 6c 65 74 31 74 31 03 43 52 45 41 54 45 20 ablet1t1.CREATE
| 4016: 54 41 42 4c 45 20 74 31 28 61 20 49 4e 54 45 47 TABLE t1(a INTEG
| 4032: 45 52 20 50 52 49 4d 41 52 59 20 4b 45 59 20 41 ER PRIMARY KEY A
| 4048: 55 54 4f 49 4e 43 52 45 4d 45 4e 54 2c 0a 62 2c UTOINCREMENT,.b,
| 4064: 63 2c 64 2c 65 2c 66 2c 67 2c 68 2c 6a 2c 6b 2c c,d,e,f,g,h,j,k,
| 4080: 6c 2c 6d 2c 6e 2c 6f 2c 70 2c 71 2c 72 2c 73 29 l,m,n,o,p,q,r,s)
| page 2 offset 4096
| 0: 01 00 00 00 00 01 00 00 10 00 01 00 00 00 00 01 ................
| 16: 00 00 00 00 02 00 0f f0 00 15 00 00 00 03 02 00 ................
| 32: 00 00 d9 05 00 00 00 03 02 00 00 00 00 05 00 00 ................
| 48: 10 03 02 00 00 00 00 05 00 00 00 03 02 00 00 00 ................
| 64: 00 05 00 00 00 02 62 00 00 00 00 05 00 00 00 03 ......b.........
| 80: 02 00 00 00 00 05 00 00 00 03 02 00 00 00 00 05 ................
| 96: 00 00 00 03 02 00 00 00 00 05 00 00 00 03 05 00 ................
| 112: 00 00 03 03 01 00 00 23 02 00 00 4f 00 02 00 00 .......#...O....
| 128: 10 25 02 00 00 00 00 03 00 00 00 23 02 00 00 00 .%.........#....
| 144: 00 03 00 00 00 23 02 00 00 00 00 03 00 00 00 23 .....#.........#
| 160: 05 00 08 90 06 05 00 00 00 06 01 ff 00 00 00 03 ................
| 176: 00 00 00 06 02 00 00 00 00 02 ff 00 00 00 00 00 ................
| page 3 offset 8192
| 0: 05 00 00 00 09 0f d0 00 00 00 00 19 0f fb 0f f6 ................
| 16: 0f f1 10 ec ec e7 0f e2 0f dc 0f d6 0f 00 00 00 ................
| 1072: 00 97 4c 0a 24 00 ae 00 00 00 00 00 00 00 00 00 ..L.$...........
| 4048: 00 00 00 16 83 39 ff ff ff 14 81 16 00 00 00 12 .....9..........
| 4064: 81 02 00 00 00 10 6e 00 00 00 0e 5a 00 00 00 0c ......n....Z....
| 4080: 46 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 F...............
| page 4 offset 12288
| 1072: 97 4d 32 14 00 ae 00 00 00 00 00 00 00 00 00 00 .M2.............
| 4080: 00 00 00 00 00 00 00 07 01 03 11 02 74 31 00 bd ............t1..
| page 5 offset 16384
| 0: fa 0f 7c 00 0a 0f 74 00 0f f9 0f eb 0f dd 0f cf ..|...t.........
| 16: 0f c1 0f b3 0f a4 0e 94 0f 84 0f 74 0f 74 0f 74 ...........t.t.t
| 32: 0f 74 0f 64 0f 00 00 00 00 00 00 00 00 00 00 00 .t.d............
| 3952: 00 00 00 00 07 05 00 00 00 02 00 be 0f 8c 10 07 ................
| 3968: ff ff 00 00 07 05 00 00 00 02 00 aa 0f 9b f0 08 ................
| 3984: c8 00 00 00 37 06 00 00 00 01 00 96 0f ac 00 08 ....7...........
| 4000: 00 00 00 b3 07 15 00 10 00 02 00 82 0f ba 00 07 ................
| 4016: 00 00 00 06 05 00 00 00 01 6e 0f c8 00 07 00 00 .........n......
| 4032: 00 06 05 00 00 00 01 5a 03 f6 00 07 00 00 00 06 .......Z........
| 4048: 05 00 00 00 01 46 0f e4 00 07 00 00 10 06 05 00 .....F..........
| 4064: 00 00 01 32 10 02 00 07 00 00 00 07 05 00 00 00 ...2............
| 4080: 01 1d ff ff ff 07 10 00 00 06 05 00 00 00 01 0a ................
| page 6 offset 20480
| 624: 00 00 00 00 00 21 97 00 00 00 00 00 00 00 00 00 .....!..........
| 1120: 00 00 00 00 00 24 57 3e 00 00 00 00 00 00 00 00 .....$W>........
| 1616: 00 00 00 00 1f 97 00 00 00 00 00 00 00 00 00 00 ................
| 2112: 00 00 00 1e 97 3d 00 00 00 00 00 00 00 00 00 00 .....=..........
| 2608: 00 1d 97 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
| page 8 offset 28672
| 1184: 00 00 00 00 00 00 00 00 00 97 4d 1e 13 ff ae 7c ..........M....|
| 4080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 90 ................
| page 9 offset 32768
| 256: 0d 01 c0 00 01 04 30 00 04 30 00 00 00 00 00 00 ......0..0......
| page 10 offset 36864
| 0: 0d 00 22 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
| 4080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 05 ................
| page 12 offset 45056
| 0: 0d 00 00 00 01 04 30 00 00 00 00 00 00 00 00 00 ......0.........
| page 14 offset 53248
| 0: 0d 00 00 00 01 04 30 00 04 30 00 00 00 00 00 00 ......0..0......
| 1072: 96 4d 5a 14 00 00 00 00 00 00 00 00 00 00 00 00 .MZ.............
| page 16 offset 61440
| 0: 0d 00 00 00 01 04 30 00 04 30 00 00 00 00 00 00 ......0..0......
| 1072: 97 4d 6e 14 00 ae 7b ff ff ff ff 00 00 00 00 00 .Mn.............
| page 18 offset 69632
| 1056: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 97 ................
| 1072: 4d 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 M...............
| 4080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0d ................
| page 20 offset 77824
| 1056: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 97 ................
| 1072: 4d 81 16 14 00 ae 00 00 00 00 00 00 00 00 00 00 M...............
| 4080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0f ................
| page 22 offset 86016
| 0: 0d 00 00 00 01 04 2f 00 04 2f 01 00 00 00 00 00 ....../../......
| 1056: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 97 ................
| 1072: 4d 81 2a 14 00 00 00 00 00 00 00 00 00 00 00 00 M.*.............
| page 24 offset 94208
| 1072: 00 97 4c 0a 14 00 ae 7c 00 00 00 00 00 00 00 00 ..L....|........
| page 25 offset 98304
| 1056: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 97 ................
| 1072: 4d 81 3e 14 00 ae 7c 00 00 18 ff 00 00 00 00 00 M.>...|.........
| page 27 offset 106496
| 0: 00 00 00 00 00 00 00 12 00 00 00 07 00 00 00 1d ................
| 16: 00 00 00 09 00 00 00 1f 00 00 00 0b 00 00 00 21 ...............!
| 32: 00 00 00 0d 00 10 00 25 00 00 00 0f 00 00 00 27 .......%.......'
| 48: 00 00 00 11 00 00 00 00 00 00 00 00 00 00 00 00 ................
| page 32 offset 126976
| 2512: 00 00 00 00 00 00 00 45 21 00 00 00 00 00 00 00 .......E!.......
| page 35 offset 139264
| 0: 00 0a 08 44 00 05 02 77 00 0e 11 0a 92 00 00 00 ...D...w........
| 1120: 00 00 00 00 00 20 97 00 00 00 00 00 00 00 00 00 ..... ..........
| 1616: 00 00 00 00 22 00 00 00 00 00 00 00 00 00 00 00 ................
| 2608: 00 00 00 97 3d 04 00 00 00 00 00 00 00 00 00 00 ....=...........
| 3104: 00 1c 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
| 3600: 00 97 3d 04 ae 7c 00 00 00 00 00 00 00 00 00 00 ..=..|..........
| 4080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 1a ................
| page 36 offset 143360
| 0: 0a 08 44 00 04 02 00 00 00 00 00 00 00 00 00 00 ..D.............
| 1120: 00 00 00 00 00 2a 97 3e 04 00 00 00 00 00 00 00 .....*.>........
| 1616: 00 00 00 00 2c 97 3e 00 00 00 00 00 00 00 00 00 ....,.>.........
| 2112: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 38 ...............8
| 2128: 00 00 05 cd 00 00 00 00 00 00 00 00 00 00 00 00 ................
| 3600: 00 97 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
| page 38 offset 151552
| 2464: 00 00 00 00 00 00 00 00 00 6e 00 00 00 00 00 00 .........n......
| page 40 offset 159744
| 2512: 00 00 00 00 00 00 00 00 82 00 00 00 00 00 00 00 ................
| page 42 offset 167936
| 2512: 00 00 00 00 00 00 00 96 00 00 00 00 00 00 00 00 ................
| page 44 offset 176128
| 2512: 00 00 00 00 00 00 00 00 aa 00 00 00 00 00 00 00 ................
| end crash-41390d95d613b6.db
}]} {}
do_catchsql_test 10.1 {
SELECT * FROM t1 WHERE a<='2019-05-09' ORDER BY a DESC;
} {1 {database disk image is malformed}}
finish_test