Commit Graph

19807 Commits

Author SHA1 Message Date
drh
f9dc5f7726 Fix a potential buffer overread in the dbstat virtual table when processing
a corrupt database file.

FossilOrigin-Name: a62e6b593b59eae44d299842a4d02b9346a0c72a3e1206882f304ab40f2cd5c5
2018-11-13 20:21:52 +00:00
drh
91a21f4d08 Turn on ASAN for the dbfuzz2 utility. Fix a buffer overread associated
with sqlite3_deserialize().

FossilOrigin-Name: 4e38f27b55030e908bd36f32101e26b30f10dbde67e12c8197d0363ee12aa06d
2018-11-13 19:51:41 +00:00
drh
2296b67598 New hyperlinks in comments used to generate documentation. No changes to code.
FossilOrigin-Name: f9755f81b1c0fd29f242dce78a2fba570fa2714d76e93b8563f426a040352513
2018-11-12 15:20:44 +00:00
dan
2639ddc474 Fix a use-after-free problem in the fts5vocab virtual table.
FossilOrigin-Name: ac69d169c61c973448b1d3eef5b8ff0de2d932d7bb74068344cb1b79bd330578
2018-11-12 13:20:00 +00:00
drh
38fa8c9bb0 Add support for read-only shadow tables on virtual tables. Added the
SQLITE_DEFAULT_DEFENSIVE compile-time option that can put SQLite in 
defensive mode by default.

FossilOrigin-Name: 9c685171c4d7ae8615d1489c9621aba79fe4ef1f0e56b75823b88c3e70d127df
2018-11-10 18:23:32 +00:00
dan
d01372f1b8 Add the "changesetfuzz" program. For fuzzing changeset blobs.
FossilOrigin-Name: 2bae0e7c1c1393aeb0bb7234865e410c9ca0e3c31cdc8566e9503f70ca7ac64c
2018-11-10 17:37:39 +00:00
dan
ad5bafa699 Merge latest trunk changes.
FossilOrigin-Name: b6d549c988e765789c4a81d586170451db9f5da1973dde8aa0329445f915fbb2
2018-11-10 17:36:55 +00:00
drh
ab0659fdab Remove a NEVER() that is reachable after all. Reverts checkin [9292d3351c40339].
FossilOrigin-Name: c5dc7fb873b15bd4e4f31b944c9feee78ab7ec2cb74f5fc55b615fd0e2784a88
2018-11-10 04:14:51 +00:00
drh
1ca9a8b9df Merge fixes from trunk.
FossilOrigin-Name: bf88efcec40036e0805940ff6371643dbc518442457d2bc18c711753607ae36c
2018-11-10 03:47:40 +00:00
drh
ac4b8dea9b Fix invalid use of unprotected sqlite3_value objects in the sqldiff utility,
when using the --changeset option.

FossilOrigin-Name: a8d65214a567eb1afd703ee4d09d398247e060a610b46097a726364db2861001
2018-11-09 23:41:57 +00:00
dan
b430701823 When a table is renamed using "ALTER TABLE RENAME TO", update any REFERENCES
clauses that refer to the table, unless "PRAGMA legacy_alter_table" is true
and "PRAGMA foreign_keys" is set to false (i.e. so that when "PRAGMA
legacy_alter_table" is set behaviour is still compatible with versions 3.24
and earlier).

FossilOrigin-Name: ae9638e9c0ad0c366f93c88a850f6b4cc86881e9f3f9f1e39574d9d83ddd8a6a
2018-11-09 20:04:05 +00:00
drh
0b57d312b7 Fix for ticket [787fa716be3a7f650cac]
FossilOrigin-Name: 531eca6104e41e4301fa2cf58bb8fec811da31e151a0f766c93aece5521d235b
2018-11-09 14:17:51 +00:00
drh
145d0a35d9 In the treeview.c module, break out the display of SrcList into a separate
subroutine, so that it can be invoked while debugging.

FossilOrigin-Name: 8c74065f0031274d9bc711d5d53c39aefcfb2b2679811105974a2c7c7a9e1dcb
2018-11-08 22:53:06 +00:00
drh
635b4ce5f7 Improved documentation for SQLITE_DBCONFIG_DEFENSIVE. Add a NEVER() macro
on an unreachable branch.

FossilOrigin-Name: 9292d3351c40339de7ad6bc26c02e7592e6cdee2592e0c790fae63ccf21ea88c
2018-11-08 17:32:50 +00:00
dan
dbc1e9e6a8 Add tests and a fix for program "changesetfuzz".
FossilOrigin-Name: 09b90db56c2d5e3aceae59c6bf1eb07f9db9ef38da29d2162046b88d39e47b86
2018-11-08 14:59:51 +00:00
dan
be075d1188 Merge latest trunk changes into this branch.
FossilOrigin-Name: 53cd91d00594f1bd7c0a565a35ec9cac3095a583022d6211158a369e942257b0
2018-11-07 20:13:45 +00:00
dan
5704f455b9 Fix minor issues in the changesetfuzz program.
FossilOrigin-Name: 5c7f024073bc93089f038b5cf122a7a9d5b933f7c1b357f6d20ae925739ffc38
2018-11-07 20:07:28 +00:00
dan
7844d21536 Update the "changesetfuzz" program to work with patchsets as well as
changesets.

FossilOrigin-Name: 75b00fbe884d4bd8ba099d7c0a2e8af2f40fedfdef2d9b624dd51cb66952611c
2018-11-07 17:52:29 +00:00
drh
e1857cc015 Performance improvement in subroutine that decides whether or not a table
is read-only.

FossilOrigin-Name: 6e4968b00507c4fdbe7e3c91f3f9cd61c6f1848092ddcf306f9fcb101a47fce7
2018-11-07 16:46:43 +00:00
drh
b39dd52adb Merge the onefile permutation fix from trunk.
FossilOrigin-Name: e543bff87d1efc31a5b863085c056ce06c365cc7d9d3fef0ced7521bde536783
2018-11-07 16:12:34 +00:00
drh
b7c2cf0aaf More test-case adjustments for defensive mode.
FossilOrigin-Name: 911e8a17a3810cd7042e91a32aba80dc3d6be88320c208e48f7bcee8b22a0ff2
2018-11-07 14:41:08 +00:00
dan
9db4828662 Fix a problem with the handling of SQLITE_FCNTL_PRAGMA in the test_onefile.c
demo.

FossilOrigin-Name: 13e21b7da8fe754e230b09ca0b9f1f69cd9aa20d4407ddd8b95ca3fb18c9abeb
2018-11-07 14:39:22 +00:00
drh
6b758e1d96 Merge the permutations fix from trunk.
FossilOrigin-Name: b753d849fe0524e14ae9367a47e29be76332fafb77bfe13e266aeef1ef6742ce
2018-11-07 13:41:27 +00:00
dan
7d0fa14c03 Partially revert [3e1a2f661], as some test scripts require separate $presql
and $dbconfig variables.

FossilOrigin-Name: cbf85284beb60d068b446c52f000d694a810d4de9096ad2951523a4c88e7334c
2018-11-07 11:56:23 +00:00
drh
6ab91a7a7a Add the SQLITE_DEFAULT_DEFENSIVE compile-time option. Fix up test cases
so that they work with DEFENSIVE enabled.

FossilOrigin-Name: 3212733cb6d1a59516d67a86df7c7b1d2456a1b2e5d7080c26b0e87b2609c65d
2018-11-07 02:17:01 +00:00
dan
005d4c61c1 Update the changesetfuzz program to fuzz changeset schemas as well as data.
FossilOrigin-Name: 141a93c843d501d8bb640228645ead0a83870c1c11e9d4b07ed24b296c69a0b8
2018-11-06 20:08:03 +00:00
drh
0f0d3ddf71 Enable DEFENSIVE mode by default for tests. This requires lots of case of
turning DEFENSIVE off in order to dodgy things to the database for testing
purposes.  No all of those cases are yet handled, so "make test" does not run
to completion.

FossilOrigin-Name: a1d6c6712c3304fd736077432c8c180692cf7d79be7f3a073510b6dab0eb951f
2018-11-06 19:26:04 +00:00
drh
aef15e74c8 Turn on defensive mode for running test scripts. Does not yet work.
FossilOrigin-Name: 1c1d24edbb732f2a2002a741c7a7afdd010b67e1b5e6d90ff36c6428897e7612
2018-11-06 15:57:59 +00:00
drh
fc25721c9e Only allow shadow table to be written from within a recursive SQL call.
Omit the SQLITE_PREPARE_SHADOW flag.  Some tests are failing because the
tests depend on being able to write to shadow tables.

FossilOrigin-Name: d890c6582524677666e6f5b5817331dec332ade16b2f744cbb8a3c7dd9b63e21
2018-11-06 14:03:07 +00:00
drh
5a65470300 Add enforcement of read-only on shadow tables. This does not currently work
since some virtual tables are attempting to update shadow tables using
sqlite3_exec().

FossilOrigin-Name: f79b47c9859de597d5924870752dd7cab89c8f0608e5cceb2281f6ffb2e91930
2018-11-06 13:37:20 +00:00
drh
84c501bac1 Initial code to make shadow tables read-only to ordinary SQL. The now
xShadowName method is added to the sqlite3_module object and is used
to identify potential shadow tables.  The SQLITE_PREPARE_SHADOW argument
to sqlite3_prepare_v3() is defined.  It is designed to permit writing to
shadow tables, but is currently an unused placeholder.

FossilOrigin-Name: 31942b3dd3f66eb0d9977bf1cadc2f2d7be7967cce2b55784be0b939dfef1985
2018-11-05 23:01:45 +00:00
dan
f095a1affb Add preliminary version of "changesetfuzz" program. For fuzzing changeset data
without creating corrupt changesets.

FossilOrigin-Name: 81ac8745faac0bda8d68ac113f1938f0e25208642e8ceb2af452680086454cb5
2018-11-05 20:37:33 +00:00
drh
2d13f6016b Add the SQLITE_DBCONFIG_DEFENSIVE flag.
FossilOrigin-Name: 11d98414eac467affb0b3cf0c7e5cc3d43184fc2b6e7e898bb5277b51ea9e1fa
2018-11-05 19:37:30 +00:00
drh
9196c81406 Eponymous virtual tables appear to exist in all schemas. This is an alternative
and improved fix to the eponymous virtual table in trigger problem that
was previously addressed by checkin [1fa74930ab56171e].

FossilOrigin-Name: b8d35c4a7c99ce3753761e5b81269d52c3c910c603fa70b72549883ba68bc485
2018-11-05 16:38:10 +00:00
drh
383bb4fa62 Disable the IS NOT NULL optimization when the IS NOT NULL operator is part
of the ON clause of a LEFT JOIN. Fix for ticket [65eb38f6e46de8c75e188a17ec].

FossilOrigin-Name: af39661e60f562b9eb10343fd83e8fe21be4d7276111e7853c1179a24cab09ce
2018-11-05 07:53:17 +00:00
drh
0f1c2eb5f2 Correct the internal logic for SQLITE_DBCONFIG_DEFENSIVE.
FossilOrigin-Name: 76094345821246c887a31a234b339d03a78eddbb9fab33b06c3c20797c038349
2018-11-03 17:31:48 +00:00
dan
29d77dc450 Add extra defenses against strategically corrupt databases to fts3/4.
FossilOrigin-Name: d44318f59044162e229a444582692e9788f17b5c404b4eb702f4c2114b22fefe
2018-11-03 16:51:30 +00:00
drh
a296cda016 Add the SQLITE_DBCONFIG_DEFENSIVE flag.
FossilOrigin-Name: af3f29d49359af2291b1d9e06e0db76fd000fbd24b4ac84d2668a0d1322efd83
2018-11-03 16:09:59 +00:00
drh
c6e519f335 Fix a assert() in the query planner that can arise when doing row-value
operations on a PRIMARY KEY that contains duplicate columns.
Ticket [1a84668dcfdebaf12415d].

FossilOrigin-Name: dcb8c73594ea6b12bad98dc883a585d3e6b925c2ead267dc40332b3d266db5e8
2018-11-03 13:11:24 +00:00
drh
147ad061f6 Enhance triggers so that they can use table-valued-functions that exist in
schemas outside of the schema in which the trigger is defined.

FossilOrigin-Name: 1fa74930ab56171e2e840d4a5b259abafb0ad1e0320fc3030066570a6dd10002
2018-11-02 17:38:39 +00:00
drh
7301e77402 Deploy the sqlite3Strlen30NN() function (argument guaranteed to be non-NULL) for
a small performance improvement.

FossilOrigin-Name: 4a6ad5190b62020d97a7de02c801544f20b7b98145ceff14af1f2834d3057f9c
2018-10-31 20:52:00 +00:00
drh
a60c63013e Add support for the SQLITE_PREPARE_NORMALIZED flag and the
sqlite3_normalized_sql() when compiling with SQLITE_ENABLE_NORMALIZE.
Also remove unnecessary whitespace from Makefiles.

FossilOrigin-Name: 790ea39a6585ea9f4dad9e132e1fb0447ac1558f728196580d2c3edee84823f7
2018-10-31 19:01:13 +00:00
drh
f8181eaa20 Tweaks to the test_intarray documentation and tests.
FossilOrigin-Name: 7107f0dacf4467430d1ca157cb848dde984e48e529e7d67a88b7594b0f8159c9
2018-10-31 18:24:29 +00:00
drh
05209e9021 Merge fuzz test cases computed by dbfuzz2.
FossilOrigin-Name: e0d30c1862884049098e1fa9b7c228ff8318a40c09e2516ef2dc8db22e2048e2
2018-10-31 01:12:06 +00:00
drh
49272bc728 Improved corrupt database detection in the relocatePage() routine of
the b-tree module.

FossilOrigin-Name: d57873337a2a7a0d717dc7726cd2682b5bea594d2d1ff8f16c2485161fcd6b16
2018-10-31 01:04:18 +00:00
drh
c985c2822c Add new fuzzer cases generated by dbfuzz2.
FossilOrigin-Name: 79fdad8b42869100845eed36224602452486d0166c18cec7d343040fdac7379e
2018-10-30 23:45:18 +00:00
dan
b74cf4b6ea Update comments in sqlite3session.c to describe the format of "rebase blobs",
as well as changesets and patchsets.

FossilOrigin-Name: bf93f7b56b1d15682988daf3f1c293caf755433defdecd52ba8782fc40e92bd7
2018-10-30 19:14:16 +00:00
drh
fd748c6460 Split the SQLITE_WriteSchema flag in two flags, WriteSchema and
SQLITE_NoSchemaError.  Set only WriteSchema on a VACUUM to avoid problems
when trying to vacuum a corrupt database.  With this change, the size
of the flags field on sqlite3 must grow from 32 to 64 bytes.

FossilOrigin-Name: 4f9878107a54356b7105fa1db7655ee239685d570436f6ad4d4221c9bd829b3d
2018-10-30 16:25:35 +00:00
drh
a751f39c3f Modify the CLI so that the --deserialize option is only available if it is
compiled with SQLITE_ENABLE_DESERIALIZE.  DESERIALIZE is now off by default
for the main.mk makefile, but on for Makefile.in and Makefile.msc.

FossilOrigin-Name: 90b2a684f775e1468d63bf950119cf0aaa62b5a449f518e7cc513c314191dd14
2018-10-30 15:31:22 +00:00
drh
ad9bfa5e07 Improvements to the -fsanitize=fuzzer based database file fuzzer.
(Cherrypick from the rubust-against-damaged-db branch.)

FossilOrigin-Name: 3cc01a0eaf54e3d5adf206825cfcab15edf73bd5aea10dfc497efd78071a17d0
2018-10-30 15:20:35 +00:00