Commit Graph

19931 Commits

Author SHA1 Message Date
dan
16dd3985f0 Fix a segfault caused by using the RAISE function incorrectly (library now
returns an error instead of crashing).

FossilOrigin-Name: ddf06db702761d663119d508afe21d7dfebe963d576bb42fc2f2024205ab86f8
2018-12-20 15:04:38 +00:00
dan
397a78d4a1 In defensive mode, do not allow shadow tables to be renamed using ALTER TABLE.
FossilOrigin-Name: 23e200da5cfbde0798e67cd9e016e4a1cd73b67981e1af841493fcd123d8f547
2018-12-18 20:31:14 +00:00
mistachkin
99490934ae Move variable declaration to address compilation issue (C89).
FossilOrigin-Name: d64f248da3ce7762fe2c17fbc83f7bea9ffca73723bb3ad0982a85320839da90
2018-12-17 22:19:57 +00:00
dan
bef06d2637 Fix errors in comments in fts5.h.
FossilOrigin-Name: 4002790d9418289f3e090c694f651a89d8f523119c8ce2f396999b0387148241
2018-12-15 07:12:34 +00:00
drh
3c2db5def6 Fix harmless compiler warnings.
FossilOrigin-Name: 27221c69901d2b4546167639c4a3c8f54b2e18820f1346870fa26b7c919027db
2018-12-14 18:11:02 +00:00
drh
ae10474125 Fix possible integer overflow while running PRAGMA integrity_check on a
database file with a badly corrupted freelist.

FossilOrigin-Name: 395599116d801324f0763e59bc5e2fc8622aa5b7572e0c1c9a982efbb3cc8280
2018-12-14 17:57:01 +00:00
drh
d7a5e49840 Back out the expansion of the temporary buffer size from
[32754ca6f86da816] and replace it with an explicit test for buffer
overreads.

FossilOrigin-Name: 8ba3d9f38090c4bbbcffba1930e5c26f69ff61f49b72a4a5a59253d37341380f
2018-12-14 16:20:54 +00:00
drh
e7acce66b2 Avoid a buffer overread in ptrmapPutOvflPtr() that can occurs in a
corrupt database file that has large entries and uses autovacuum.

FossilOrigin-Name: f8b781cf41800e9f61a1c5376404a97e76a2bbbcaa17396d42be62f731363947
2018-12-14 16:00:38 +00:00
drh
fa94d492c8 Fix a harmless compiler warning in Sessions.
FossilOrigin-Name: fc9791ea987352e3e1322fbb7f833c23b402432af8249f9d397c6f7456788637
2018-12-14 13:47:17 +00:00
drh
d6401e869b Expand the size of the temporary page used during btree rebalancing by a
few bytes, to avoid problems with small buffer overreads that can occur
on corrupted database files.

FossilOrigin-Name: 32754ca6f86da8165e274f98f35fc3df3aebd273e9da08387e2d0c3c89abda0f
2018-12-14 13:35:48 +00:00
dan
fffaf23013 When saving the position of a cursor at the b-tree layer, allocate a few extra
bytes at the end of the buffer used to save the key. Otherwise, if the key is
corrupt, the code that restores the cursor position may overread the buffer by a
little.

FossilOrigin-Name: 160b1e31c0f27257c06c2987af9ec3a64abfacb2150325b72e8ccd3d217b5baa
2018-12-14 13:18:35 +00:00
drh
5a1ce4369f Fix a problem with bytecode generation when a query involves two or more
indexes on expressions connected by OR.
Ticket [d96eba87698a428c1ddd0790ea04]

FossilOrigin-Name: 7e4ed8b5c2047b69bbb037497111e56e465a4d9f8afca3b337f9ac744471dc4a
2018-12-14 11:16:52 +00:00
dan
7525b87b6c Posible fix for [d96eba87].
FossilOrigin-Name: 89a25abfcd069aebdf817890e5c27f46de3000fb858ae01029e4528f9d677567
2018-12-14 08:40:11 +00:00
drh
d8cc8b30b4 Fix a bug in fuzzcheck that cause it to overlook a pointer-map bug that was
trigger by the fuzzcheck test data, and also fix the pointer-map bug.

FossilOrigin-Name: cc42dd15100db28a9796254f69a4e367ea5eae29f546be055017cf3e12aa66ba
2018-12-14 03:16:17 +00:00
drh
203b1ea0f5 Detect when an attempt is made to write to a pointer map page that is also
being used as a btree page and report corruption.

FossilOrigin-Name: 3036fd71ac7063359b04a0ed54a6c63a380eb7ff75cd29ed27486d4259066aee
2018-12-14 03:14:18 +00:00
drh
e45985b595 Fix a bug in the custom in-memory VFS used by fuzzcheck. This bug masks
other bugs that should have caused some existing fuzzdata7.db entries to
fail, and so this fix is initially on a branch until those other bugs can
be repaired.

FossilOrigin-Name: e0994e99955cf11f23dba029b5ed7f150f467887558848d5f03510e2fb5855f9
2018-12-14 02:29:56 +00:00
drh
f354e77f3d Fix the dbtotxt decoder in the CLI so that it ignores excess bytes.
FossilOrigin-Name: 18740bd448887d618fafee0b5a7c004aa2f2632244f7d29e2428772baa36b828
2018-12-13 22:58:52 +00:00
drh
6301c43f23 dbfuzz2 found a NEVER() that is sometimes true.
FossilOrigin-Name: 1201615cbbd3070158ea5fab3d2c8c95f41b25d6da096a44cb9257a7b7405efc
2018-12-13 21:52:18 +00:00
drh
8061ad8abd Add extra tests for database corruption inside the defragmentPage() routine,
as dbfuzz2 has found ways for corruption to leak into that point.  Add test
cases in fuzzdata7.db.

FossilOrigin-Name: 997b65117f8c12dba5fb85434fde9765cdb0d2a49cc3e31979abba3e21350086
2018-12-13 21:11:22 +00:00
drh
1641f11f4c Fix a problem in sqlite3BtreeDelete() in which deleting an entry from a
corrupt database can leave a btree page with zero cells.

FossilOrigin-Name: 682053d1e603c21b8085c39db618a39b23ec8d2c4d822fd19634db0e03038ea2
2018-12-13 21:05:45 +00:00
drh
f7e74904cc Add the "decode_hexdb" TCL command to testfixture. Add the dbfuzz001.test
module to demonstration how to use decode_hexdb to deserialize a dbtotxt
database description for use in a corruption test.

FossilOrigin-Name: 1f583c53f3b7318c69f6e235934d97ef9493278feeab0837217076d7d071c35b
2018-12-13 20:49:43 +00:00
drh
2c8ee026ba Fix the CLI to keep proper track of input line numbers for use in error
messages, even after processing in-line hex database inputs using
".open --hexdb".

FossilOrigin-Name: 7ffa9858162774cba03a565a7b65135d9e8bfea726af1a29de6898f66c4b1261
2018-12-13 18:59:30 +00:00
drh
60379d4243 Fix the CLI so that the ".open --hexdb" command works even if it is contained
in a subscript that is read using ".read".

FossilOrigin-Name: 67a87399b8ad8f1ce3052ee3159906f5c6df3d7b5691b3acac856bd2f1c82088
2018-12-13 18:30:01 +00:00
drh
51caa04836 Merge the dbtotxt enhancement from trunk.
FossilOrigin-Name: b386fce9a23e628dce7362dcca2904b8d0af6da58a6fe6eb7f12f058a8363e49
2018-12-13 15:52:31 +00:00
drh
3374648545 Add the "dbtotxt" utility program and the ability to read "dbtotxt" output
as a deserialized input database in the CLI, using the --hexdb option to
the ".open" command.

FossilOrigin-Name: e3bf1d3ea5f748c5142c2403813fdace5aedc1fc68f0dcd5eae40a2fe763fedb
2018-12-13 15:06:26 +00:00
drh
69a66a7be1 Include OPTS in the build of dbfuzz2.
FossilOrigin-Name: eac9c0c49650b008951318a2225b932709a0a8dffbb01ed57684c40357b2e25c
2018-12-13 12:37:13 +00:00
drh
bc1be957c1 Fix the Makefile so that it honors CFLAGS when building sessionfuzz.
FossilOrigin-Name: 54231ac4ca506e6c34c31bc02bb8d3db22f14e1b01679bc70529b165d7dabb83
2018-12-13 12:28:01 +00:00
drh
5881dfea2c New database corruption test cases discovered by dbfuzz2. The new cases
have been added to test/fuzzdata7.db, but have not yet all been fixed,
so tests will not currently pass.

FossilOrigin-Name: b4210d320c6426d2838d4cc08709fdfd015c1c95fcad9a5f9e8fd390c23b9fad
2018-12-13 03:36:13 +00:00
drh
cb0e04f929 Fix another problem found by Matthew Denton's new fuzzer.
FossilOrigin-Name: 2b690dbdffe144bd69ca0aa291c230faf3d9d73f7a2985d50f016fe54003f9a9
2018-12-12 21:34:17 +00:00
drh
89b6de0357 Remove an ALWAYS() from a branch that is not always taken. The test case
found by OSSFuzz has been added to TH3.

FossilOrigin-Name: 5c7dab85535ac42c021977dbd4a39cef5a72e3d9dccff1c5ca5570a1780516cd
2018-12-12 20:11:23 +00:00
drh
03c5c21328 OSSFuzz found a case where an assert() inside sqlite3ExprCompare() can be
true.  Test case added to TH3.

FossilOrigin-Name: 23b62fb160d86dc9d9073bcc714601f5b7695f96abd893eafecf4b2e565b87f2
2018-12-12 11:23:40 +00:00
drh
cfc078318c Small performance improvement in sqlite3_step().
FossilOrigin-Name: d1db8d5894450b24bb0335983503d9bbf6cc48a0ae4b83291283fb2d32b6b25b
2018-12-11 12:51:46 +00:00
drh
368bfe8b00 Small performance improvement in the sqlite3_bind() family of interfaces.
FossilOrigin-Name: 1dc0c3df32572f09265fc73eeaa0748159e0e9523b9b2d6768b834a29c909968
2018-12-11 12:20:41 +00:00
drh
1a6c2b1d38 Further refinements to the sqlite3_normalized_sql() interface. TH3 now
gives 100% MC/DC on that interface.

FossilOrigin-Name: c96bf6cca220e363b099455ce35195ce7e89d374a52dc787f56e7b11e587bced
2018-12-10 20:01:40 +00:00
drh
21b9225ff5 Refactor the sqlite3_normalized_sql() implementation.
FossilOrigin-Name: 06e955e5d2b857b9ce94a73fb174b620c101bdb160842f9a0e958bdb48e8c987
2018-12-10 18:15:44 +00:00
drh
9042ff214b Fix issues with the new normalizer.
FossilOrigin-Name: 057d7d40c56b7416a59a79cb627b2b3e5837eca2d6dbcb50127baaadf1941f51
2018-12-10 16:49:33 +00:00
drh
643d855da9 Refactor the sqlite3_normalized_sql() implementation. This is a
work-in-progress. There are still issues.

FossilOrigin-Name: a4c890b0af9786295e6df05022009d8946550adb873535c610be805c2b7a4083
2018-12-10 16:00:57 +00:00
dan
dc6214ee39 Fix a problem with using "<db>-vacuum" (the default) as the state database
when resuming an RBU vacuum.

FossilOrigin-Name: c878d741733a897d47a1a0b57b454bc9095ce302b48cc01089336d5d20e2a24c
2018-12-10 08:41:32 +00:00
drh
fb34559eb1 Add support for the VACUUM INTO command.
FossilOrigin-Name: 77f150b8b46761f4f62f9d8926c10a95a70589a4525393fc16b321bd98c083a7
2018-12-10 01:48:29 +00:00
drh
4d342827d6 Fix the shell1.test test for the new format of the .backup command.
FossilOrigin-Name: 9748d7995bc1dd632d66d2d326048d50e29c6f5e6993d5a6294d14421d2cb72f
2018-12-10 00:41:28 +00:00
drh
2134eb5721 Merge fixes from trunk.
FossilOrigin-Name: ab1e58fac9e3f9d7d90cefb39f8f145d211d38ec0cb393208c4531cc646056c1
2018-12-10 00:40:43 +00:00
drh
ce706c2cf3 New test case for ticket [1d958d90596593a77420e59].
FossilOrigin-Name: b7bf3c9832bde26b359f4d58ebcf7788c500586d311387d022192ed65a126252
2018-12-09 18:55:05 +00:00
drh
d4a4a36171 Do not use a partial index as a table scan in an IN operator.
Fix for ticket [1d958d90596593a77420e59].

FossilOrigin-Name: 15bc915dd7ae25bfdfbe357c3792db3639799e4d121c6b5b24297af2d6d7129e
2018-12-08 20:30:31 +00:00
drh
a50bffb85e Add the --async option to the ".backup" command in the CLI.
FossilOrigin-Name: 7b6a605b1883dfcbe237b0a58f6f0c233a109e88b521c3b3d97198526c8a0317
2018-12-08 01:09:14 +00:00
drh
2f6239ed4e Allow the INTO clause of VACUUM to be a text-valued expression.
FossilOrigin-Name: af172b53b46759f491f522356e14c5e2374d3f25ec70fbc1e100cadded8f9b22
2018-12-08 00:43:08 +00:00
drh
7464f578ed Do not allow VACUUM INTO into a file that already exists.
FossilOrigin-Name: 92f70e0fa3c9de7fde046f11cc0a7c2800511bb5ace8e68c845133931607616e
2018-12-07 23:48:41 +00:00
drh
52993b31e1 Merge the VACUUM simplification from trunk.
FossilOrigin-Name: 93d92a0a5d21a1856316c0205ecaa253691b6e5349b552d43027005676d14820
2018-12-07 20:40:12 +00:00
drh
83da91b7bd Remove a line of code from VACUUM that is no longer needed, due to the
change that allows ATTACH to run within a transaction.

FossilOrigin-Name: a92c398fc5df142ff1459c1be4a6832f2219bc7fabe5789535be3bbd41a4269b
2018-12-07 20:26:29 +00:00
drh
b0b7db91b8 Prototype implementation for the VACUUM INTO command.
FossilOrigin-Name: 036e3320a4af36c1311b25b2e504b0079c8b33df8ad7b7e5fddad07150e6f87d
2018-12-07 17:28:28 +00:00
drh
893bd3751b Fix the sqlite3_normalized_sql() interface so that it renders
double-quoted string literals as "?".

FossilOrigin-Name: 0d8e150434bbd179696f1ffe71d1e06cb3d43e6468496c7e481fca8486387bad
2018-12-07 16:32:11 +00:00