1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-14 00:22:38 +03:00
Commit Graph

1277 Commits

Author SHA1 Message Date
drh
f783893b8d Change pageInsertArray() and pageFreeArray() so that they use the CellArray
object and compute cell sizes as needed, resulting in smaller and faster code.

FossilOrigin-Name: f7f41818119bb7bfbd1f1297d294b32f32769cd3
2015-06-23 15:36:34 +00:00
drh
4edfdd38fb Improvements to the way balance_nonroot() constructs the b.apCell array of
pointers to cells.

FossilOrigin-Name: ee44bb25b2a88e25ba2afe37cf03ba199692a3a0
2015-06-23 14:49:42 +00:00
drh
1ffd247c0c Avoid computing cell sizes in balance_nonroot() until they are really needed.
This gives an overall 1.7% performance gain for about 1000 extra bytes of
code space.

FossilOrigin-Name: 43844537e8a372953386663f8177202901ba7566
2015-06-23 02:37:30 +00:00
drh
658873bdb3 Change the way that balance_nonroot() partitions cells between the sibling
pages such that a scan of the cell size array is not required.

FossilOrigin-Name: 168728715156d756ac8c0df45710d054eee027ec
2015-06-22 20:02:04 +00:00
drh
eeab2c63a9 Fix corner cases involving corrupt varint values in record headers.
FossilOrigin-Name: 3189116b42c5ecef5e30c8b317f4458bbf8b9086
2015-06-19 20:08:39 +00:00
drh
56cb04efc8 Performance improvements in btreeParseCell() by inlining the varint decoder.
FossilOrigin-Name: faab0ed928074f3ec7c25e1a2058414fbd9b013c
2015-06-19 18:24:37 +00:00
drh
5fa605142f Add the MemPage.xParseCell method and provide various implementations
(variations on the former btreeParseCellPtr()) depending on the page type.

FossilOrigin-Name: 41d03d883c4f7ca279eb9dd679f3ab81c8d957d9
2015-06-19 17:19:34 +00:00
drh
25ada07ab4 Make cellSizePtr() a method on the MemPage object, with alternative
implementations depending on the page type.  This results is a small performance
improvement and size reduction.

FossilOrigin-Name: 02f7e9d7d7b93d0b6bbd6cc0d0359b3b741b9931
2015-06-19 15:07:14 +00:00
drh
c5b41ac8ee Make getCellInfo() a real function instead of a macro, for a size reduction
and a 0.2% performance gain.

FossilOrigin-Name: 55c393ea14197ae5fa56ebca7a47e7d980511fa7
2015-06-17 02:11:46 +00:00
drh
3e24a34324 Fix a harmless comment typo. No code changes.
FossilOrigin-Name: ae6876521819e7a8ce473c8f96617cba35e2156d
2015-06-15 16:09:35 +00:00
drh
e4d38707ea Improved detection of database corruption in freeSpace().
FossilOrigin-Name: 29bcb56887f862a1f06677a7b4bfae6475d29732
2015-06-15 12:58:15 +00:00
drh
24dee9d214 Always check for cell overflow before returning a slot from the
pageFindSlot routine in btree.c.

FossilOrigin-Name: 9f035c45a4b84203e67b6e1b23cf11691dc43f1e
2015-06-02 19:36:29 +00:00
drh
cd8fb7cfd5 Fix a faulty assert() in btree.c. Update the database fuzz test file with
new test cases.

FossilOrigin-Name: 4e621af1345a001360938de76e3b0a14deb5e991
2015-06-02 14:02:18 +00:00
drh
1c8badeb26 Ensure that allocateBtreePage() always clears the MemPage pointer when
it fails due to an I/O or memory allocation error.

FossilOrigin-Name: 09a38bf665902834936d39341627ded88142e6ae
2015-05-29 18:42:11 +00:00
drh
e726622579 Move two unreachable conditionals inside of NEVER() or assert().
FossilOrigin-Name: db4e9728fae5f7b0fad6aa0a5be317a7c9e7c417
2015-05-29 17:51:16 +00:00
drh
1f2d968622 Remove a corruption test in balance_nonroot that is superceded by a prior
better check.

FossilOrigin-Name: 00693682d8664fa608ba43684f6376a9bd5b84eb
2015-05-29 17:13:14 +00:00
drh
c68275032e Added comments and testcase() macros to error cases in the btree search.
FossilOrigin-Name: 7da7dc714bf1fe34b38fc33a923490dfd3e4f070
2015-05-28 15:14:32 +00:00
drh
73d340adff Earlier detection of incompatible sibling pages in balance_nonroot.
FossilOrigin-Name: 60a09f17d8b70dbc4b020586a1b81bce76882729
2015-05-28 11:23:11 +00:00
drh
7e8c6f1c2e Add the btreeGetUnusedPage() routine to btree.c, and use it to detect content
pages on the freelist and to cause that condition to trigger an SQLITE_CORRUPT.

FossilOrigin-Name: fe15d1f70360d6fef8ef1a111dd43e060d059623
2015-05-28 03:28:27 +00:00
drh
b52e9c89df All bytes of a page are initialized, even bytes that follow a 2-byte cell
on a malformed page.

FossilOrigin-Name: 7373a004ed0e2781cda503c73e9a94f24350ef79
2015-05-27 18:13:35 +00:00
drh
f9705d4b66 A different approach to preventing buffer overreads when comparing a vector
of values with a corrupt index record that spans at least one overflow page.

FossilOrigin-Name: 95eaa49f4ee071c7a0f690a695f1f2d1ebca68a8
2015-05-27 15:42:53 +00:00
dan
3548db7c13 A different approach to preventing buffer overreads when comparing a vector of values with a corrupt index record that spans at least one overflow page.
FossilOrigin-Name: 7e9e1b6123bc455dd7d1c894b6154ccd27acec18
2015-05-27 14:21:05 +00:00
drh
1421d980c5 Add the "PRAGMA cell_size_check=ON" command.
FossilOrigin-Name: 2ead43f074d01312c7642e1df9abccc95547f019
2015-05-27 03:46:18 +00:00
dan
b95e1193d5 Avoid a buffer overread when comparing against a corrupt record that spans at least one overflow page.
FossilOrigin-Name: 62a5b3633a086694ef0e579a0a82322cb1ae3d60
2015-05-26 20:31:20 +00:00
dan
633d0753ab Add a cast to one side of the test added by [97806a78] in order to avoid a signed/unsigned comparison warning.
FossilOrigin-Name: 5b46d2a78a45de4176b666bfc89c2aaa6f083662
2015-05-26 17:33:30 +00:00
dan
fb0246ba8a Return SQLITE_CORRUPT to the user if an attempt is made to add database page 1 to the free page list.
FossilOrigin-Name: 68876003f922635737349f55bc73a78891ea7028
2015-05-26 12:18:17 +00:00
dan
c3e8ef1d0e Fix a case of a corrupt database causing SQLite to read from up to 4 bytes before the start of a memory allocation.
FossilOrigin-Name: 7d2c4f7b6695806ab8ce0c6f49d8bc1d77a4320b
2015-05-25 20:04:15 +00:00
dan
08f901b008 Have the b-tree layer return SQLITE_CORRUPT to any attempt to open a cursor with a root page number less than 1.
FossilOrigin-Name: aa18c8e9d1676b1caa53bc5f5c1dc5f201089b88
2015-05-25 19:24:36 +00:00
dan
0f8076dd69 Fix a couple of btree asserts that would fail when encountering 32-bit rollover in cell payload size fields (cell payloads this large always indicate corruption).
FossilOrigin-Name: 8fa0937a2f3476dd280259e252d6f422c33d38ee
2015-05-25 18:47:26 +00:00
dan
2fc3a6cd98 Fix a case where database corruption may cause SQLite to write past the end of a buffer.
FossilOrigin-Name: 97806a78142b15f89878e25ee70dc5b0524d6793
2015-05-25 17:07:29 +00:00
dan
cf3d17c604 Fix an assert() in btree routine freeSpace() that may be false if the database is corrupt.
FossilOrigin-Name: 00a473c56188cd60a74559effb114140e3fe8a8d
2015-05-25 15:03:49 +00:00
drh
7ca0954c2c The assert() changes removed in the previous check-in are needed after all.
FossilOrigin-Name: 336fccc84cd7b770c9c3720efc9976269096232e
2015-05-24 21:46:03 +00:00
drh
0b538f2a81 Better detection of corruption in allocateSpace() in btree.c.
FossilOrigin-Name: bf7bb53ee2485a5342916d514d6c7291eb84c5f1
2015-05-24 21:09:52 +00:00
drh
a1f75d96fd Detect database corruption in the modifyPagePointer() routine and abort.
FossilOrigin-Name: 4f0bba42f904e505900be67b00179ebb1f24ed03
2015-05-24 10:18:12 +00:00
drh
82110da971 Instead of early detection of corruption in balance_nonroot, simply ignore
the error, as it is harmless and exceedingly uncommon.

FossilOrigin-Name: 7bbf9b3cd6ebf103ebd8347579aef721d0dcd2dc
2015-05-23 19:53:48 +00:00
drh
3183ac590d Earlier detection of a specific kind of corruption in the balance_nonroot()
routine.

FossilOrigin-Name: ee6dc9913a8733891576e6e298241f7440209c5e
2015-05-23 19:29:08 +00:00
drh
cea1dc2798 Fix another bad assert() in btree - one that can be false on a corrupt database
file.

FossilOrigin-Name: 89f0bbfde4d86a7b15e93aab9c487b4355c6fb2d
2015-05-22 23:39:29 +00:00
drh
afe028a815 Fix two faulty assert statements discovered by fuzzing.
FossilOrigin-Name: 799817bfb2bc95963c0e0d70063c4cb15c94ef74
2015-05-22 13:09:50 +00:00
drh
499e15bee1 Fix an assert in btree.c that can be false when using a corrupted database
file.

FossilOrigin-Name: a6eb2a39357c35dc13d549ef86c785ff5c69938a
2015-05-22 12:37:37 +00:00
dan
dd14ecbca5 Fix a faulty assert() in the btree part of the "PRAGMA page_size = ?" code.
FossilOrigin-Name: 90b197489a37e01dcb2f3a8182848c1301e1757b
2015-05-05 10:03:08 +00:00
drh
c049057242 Cleanup of the sqlite3StrAccumInit() function. No functionality changes.
FossilOrigin-Name: 7952c32268aa650d9ee946d5bfe190f712e3bbe6
2015-05-02 11:45:53 +00:00
drh
42c0a2b2f3 Fix comment typos. No code changes.
FossilOrigin-Name: 60174cf572f8788e67a0434d5fe763724d7425a3
2015-04-28 01:28:36 +00:00
drh
a33b68364b Use a heap rather than a bitmap for cell coverage and overlap testing on
btree pages in PRAGMA integrity_check.

FossilOrigin-Name: e94b2ef2242d716379a35dba3d2df1ac512c8d30
2015-04-16 21:57:37 +00:00
drh
67731a97a2 Use a heap instead of a bitmap for cell overlap and coverage testing of
btree pages in PRAGMA integrity_check.

FossilOrigin-Name: 5619c959bf7babb19fd8ba8b228be7f090fe0ce3
2015-04-16 11:56:03 +00:00
drh
f3392e32c7 Prevent the fetchPayload() routine from reporting a cell size that extends
off the end of the page on a pathologically corrupted database file.

FossilOrigin-Name: f71053cf658b3260a32ac06f8ba5c2cde0ea54dd
2015-04-15 17:26:55 +00:00
drh
c01501a386 Remove a faulty assert() from the btree balancing logic.
FossilOrigin-Name: d06669d968c8f6af8799fbfeabadaab68b9b8db8
2015-04-13 14:44:01 +00:00
drh
ccf46d0b90 Improved detection and suppression of endless loops in clearDatabasePage().
FossilOrigin-Name: 30011ad2f55cfcacaf23a58ebcc17b17a7b9355e
2015-04-01 13:21:33 +00:00
drh
6b5f0ebe97 Handle very large URI pathnames for in-memory shared-cache databases.
FossilOrigin-Name: 586a94e85bc13700a2093734711c1367fa814b8c
2015-03-31 16:33:08 +00:00
drh
116f0be024 Prevent a possible infinite loop when trying to DROP a table from
a corrupt database.

FossilOrigin-Name: 395bb3e677a6551b06ba96fc58c393132b93d1e8
2015-03-30 23:43:56 +00:00
drh
606a357288 Change an unreachable branch into an assert().
FossilOrigin-Name: fb076b28c36975ff2e41440f22fe5de115c195da
2015-03-25 18:29:10 +00:00