Commit Graph

27773 Commits

Author SHA1 Message Date
stephan
7d3cd38034 wasm: pass the promiser function to the promiser onready() callback to simplify access to it in certain usage patterns.
FossilOrigin-Name: f8a8b9ee2eddf5f875c7c4399e750ccf1941f767560ebc2c88c083560f5aaae0
2024-02-05 03:37:54 +00:00
stephan
0009d40325 wasm: squelch a new (and, in our case, invalid) warning from emcc 3.1.52.
FossilOrigin-Name: d294a23ed6d1d2b567a02552b8a2e4921cd21891ee86e63f8f9945569e3262d3
2024-02-05 02:36:10 +00:00
mistachkin
7718c866e1 Fix a minor test file locking issue on Windows.
FossilOrigin-Name: 6cd70b71df5c0d45412081590316bced302ec4403d565250b56e611882204821
2024-02-04 04:18:29 +00:00
mistachkin
3ab9c021ff Fix harmless compiler warnings seen with MSVC.
FossilOrigin-Name: e52c87420b072fa68d921eda66069542d50accbfaf1110ac4cc1543a4162200d
2024-02-04 04:01:11 +00:00
drh
7d6f33046f Following a ROLLBACK that reverts changes to an RTREE, any pending queries
against that same RTREE abort with code SQLITE_ABORT_ROLLBACK.
dbsqlfuzz de7d17b72d0e842352c998dd86a47b7d0f707be9.

FossilOrigin-Name: af5c425114f32c2f84aea20edd4fa46eb1bfdeb3747fce357540e15978a070c8
2024-02-03 19:19:18 +00:00
drh
50f9caf270 More extensive use of SQLITE_CORRUPT_PGNO.
FossilOrigin-Name: 3838332cffb87f77a7c6b357066a59b9dc4f65ef4b3496767ad7ad7c14a77be2
2024-02-02 18:42:09 +00:00
dan
3a32690a55 Fix typo in vdbe.c comment. No changes to code.
FossilOrigin-Name: 62010ba488f65aec3c6bd17b05f64c5b3e885dee4221e6016c4eb1053e19284d
2024-02-02 11:37:03 +00:00
dan
09768559b6 Ensure the fts5 xIntegrity method correctly returns error codes unrelated to corruption or missing SQL elements.
FossilOrigin-Name: d18d9a05c2d6f290d7b16eafced0cde4eb8dd3f869778a49103812d35a0cee65
2024-02-01 15:42:22 +00:00
dan
adea051707 Ensure the fts3 xIntegrity method correctly returns error codes unrelated to corruption or missing SQL elements.
FossilOrigin-Name: 1bdb8cbaf7e733e0731de2ecd7a05ddf44db5d8595dcc7aaf0927ed0aa5b33d3
2024-02-01 15:21:55 +00:00
drh
64b76c0ed4 In PRAGMA integrity_check, defer running xIntegrity on virtual tables until
after all ordinary tables have been checked.

FossilOrigin-Name: 8f4b1ceafe4a271b23e17493a244a34c1732a3d35c5533c37394b9f3dc158435
2024-02-01 14:57:24 +00:00
drh
1d09f4d018 Add tracing logic to the shared-cache locks in btree.c. The tracing is
off by default.  Enable by changing a single "#if 0" into "#if 1" and
recompiling.  Debugging code only - no changes to release builds.

FossilOrigin-Name: f2b943f97ad7e47848ac6df3a3a1eba134b9e63c4a631f8eaf8bda77cc02ba7b
2024-02-01 14:17:01 +00:00
drh
d87299cece Add the test_oom_breakpoint() routine on debug builds, to serve as a
convenient breakpoint to intercept OOM conditions.

FossilOrigin-Name: e45df7dcd6b5766d7593ee87e59dd422a217cce0a1a8d369c03144bb21859428
2024-02-01 11:38:58 +00:00
drh
ed0a614c21 Replace an conditional assignment that was made obsolete by [d4c193f0b49f4950]
with an assert().  The conditional was added by [d6fd512f50513ab7] as
a fix for tickets [c36cdb4afd504dc1], [4051a7f931d9ba24], and
[d6fd512f50513ab7] which means now [d4c193f0b49f4950] is the correct fix
for those tickets.
that check-in

FossilOrigin-Name: 44b5524d522e749ad6bf76c94d754ff16c309c32439ec46802924663f64e8b09
2024-01-31 20:11:54 +00:00
drh
d844e0a1c4 Allow control characters in JSON5 string literals.
[forum:/forumpost/05182119f69c3a92|Forum thread 05182119f69c3a92].

FossilOrigin-Name: 380f09c194caff557640692d2f255f8cdc1dcfed5976711686466692f4d7a60d
2024-01-31 15:29:29 +00:00
drh
744581d3d6 Add NEVER() and ALWAYS() macros for the JSON5-control-character change.
Also fix an incorrect comparison used to determine if a buffer needed to
be resized.

FossilOrigin-Name: e3c0c0e686f3b7710f79587cf465b5aac52d8f2f2986a3de885a656f652cbfd3
2024-01-31 15:20:13 +00:00
drh
9486178f39 Fix failure to detect unterminated string literals in json_valid() in the
previous check-in.

FossilOrigin-Name: 5d725644621cf640fb743d59ccf89dac777540410e67501eb00b83638c8c857f
2024-01-31 14:44:59 +00:00
drh
c24f53635c Allow control characters in JSON5 string literals.
[forum:/forumpost/05182119f69c3a92|Forum thread 05182119f69c3a92].

FossilOrigin-Name: 34709c7cc910539e23a830ad8b589a97a88be25e924a59670c1017fb51447dad
2024-01-31 13:46:44 +00:00
drh
b202a452ad Fix a memory allocation bug in the (debug-use-only) json_parse() SQL function.
FossilOrigin-Name: 32ce7dacf58bbf35cf70da8b03fa25f97fcea970edbc1f8aa12739ac4c8608fb
2024-01-31 12:15:57 +00:00
drh
91981fe74e Detect malformed nested JSONB earlier and stop rendering to avoid long
delays.

FossilOrigin-Name: 72f3e1d0eca2b9ebd7c4b4cdccc6d7a0173b2fdb204cb1aa207917aedab6098a
2024-01-29 21:09:56 +00:00
drh
af3824d5fa When generated text JSON from JSONB, do not continue descending into
nested structures after an error is seen.  This avoids long loops and wait
times.

FossilOrigin-Name: 97666ec052ebaceab002874d7ca5c5e6883c3d04fb7d3992235a8c4c8d08407a
2024-01-29 20:36:17 +00:00
dan
581bf002ce Consider an index for queries like "SELECT count(DISTINCT col) FROM ...", even if the index records are not smaller than the table records.
FossilOrigin-Name: ad06868807a27f0c96fa5649ebd981e07909eb2c5e03781377c876fdec49abdc
2024-01-29 19:30:16 +00:00
dan
7f9a1ff3f2 Avoid a potential buffer overread when handling corrupt json blobs.
FossilOrigin-Name: 738473dc0ac353731080d0785cc7dc9810b564906c176916bd91d6cfbb1a7b18
2024-01-29 15:30:35 +00:00
drh
3fc7a34efc When rendering JSONB back into text JSON, report an error if a zero-length
integer or floating-point node is encountered.  Otherwise, if the node occurs
at the very end of the JSONB, the rendering logic might read one byte past
the end of the initialized part of the BLOB byte array.  OSSFuzz 66284.

FossilOrigin-Name: b0eb279ea83c1c788c39fb90e178ec99fa4c782195c376a420c661fedf4545a7
2024-01-29 12:50:32 +00:00
drh
4c11a5251a Use __ppc__ instead of __POWERPC__ to identify 32-bit PowerPC processors.
[forum:/forumpost/34794846ce|Forum post 34794846ce].

FossilOrigin-Name: c974d9313b60591bcd554c3ec652a8040d382930e30778e6be8a875145b0b3da
2024-01-28 20:42:12 +00:00
drh
5b480ead99 Automatically disable the DISTINCT optimization during query planning if the
ORDER BY clause exceeds 63 terms.
dbsqlfuzz afd1d61fc27d14938a0d78a50970fa1e9fbfee58.

FossilOrigin-Name: d4c193f0b49f4950b20c2f0e6aa037d2ed7d8c0b4687c14923b3a0d0d4a1b3fd
2024-01-28 17:39:31 +00:00
drh
d921533954 Apply the same fix found in [99057383acc8f920] to descending scans.
dbsqlfuzz afd1d61fc27d14938a0d78a50970fa1e9fbfee5.

FossilOrigin-Name: e1d463c2d6e93e0ae0a60a05a79cd346bd07142de2fe631b370a9b946763b5d6
2024-01-28 00:31:47 +00:00
drh
052f0a95d0 Improvements to parser stack overflow testing.
[forum:/forumpost/99e181b5bf|Forum post 99e181b5bf].

FossilOrigin-Name: 556c43a937f1d1c19117da24e6d892852241189f4e47e1c86aa1e8c36461c5de
2024-01-27 20:17:05 +00:00
drh
21bdfe5884 Performance enhancements to the parser template.
FossilOrigin-Name: 2db8b30acdeaeaf7ec92dc0382a25f96bca4561fb68a72713ff963e27f39c63b
2024-01-27 12:47:51 +00:00
drh
48e899a86e Use an alternative memory allocator for parser stack space that includes
a call to sqlite3FaultSim() to facilitate testing.

FossilOrigin-Name: 7c36d560ff4e8e1b3f8fad972ec7f07837e4fa4e6861fafde970ffccfda5a2f1
2024-01-27 12:25:07 +00:00
drh
ad2689fe4e Allocate new parser stack space from the heap if needed, eliminating the
possibility of a "parser stack overflow" error as long as heap memory is
available.

FossilOrigin-Name: d87a2054774aa6ce54d9ccd78899b638f1eaf4f9a1d847bf22500018049c9f8d
2024-01-27 11:35:35 +00:00
drh
7659ce22c5 Optimizations to ParseFinalize() to make up for the extra cleanup associated
with the allocated parser stack.  This branch now runs faster than trunk
and is less than 300 bytes larger.

FossilOrigin-Name: f7290db63cc2568090c14dffc4ea4eadfacb5b94b50a1852ef6eefd9e2e32533
2024-01-27 02:21:25 +00:00
drh
3467698000 Omit the "parser stack overflow" error message, since it no longer occurs.
Replace it with an ordinary "out of memory".

FossilOrigin-Name: 33f17ec24880937892d47a5a321c43785ca18e03dde28a9a0d50ae86edb29679
2024-01-27 01:35:07 +00:00
drh
51f652de10 Bug fixes in the function that expands the parser stack.
FossilOrigin-Name: e91179fe849760771c3508b1e7d75325183e5c3b029752d0a97dbdbd57188b97
2024-01-26 20:57:19 +00:00
drh
82bf13796a Experimental changes that prevent parser stack overflows by growing the
parser stack with heap memory when it reaches its limit.

FossilOrigin-Name: 3fd062905fc20507b7cfc97fa976ac5b57c5b68926bf9136bd5ea4265d2d6528
2024-01-26 20:34:48 +00:00
drh
539085ddf5 Add NEVER() to a branch that is no longer reachable.
FossilOrigin-Name: 9411337a7b3237366768fc708396da53d67a7a17b6cdc5c6f8932c5ab32217a9
2024-01-24 21:08:57 +00:00
stephan
4821b15dca Update ext/wasm/SQLTester for recent internal-API reorgs.
FossilOrigin-Name: 996cfdf9b5f70408faeaa68ba2ea9494e419be8f2c59d89ab702419056e3569c
2024-01-24 19:54:49 +00:00
drh
fa079680f1 Slight adjustment to test results for Windows in mmap1.test due to
the previous check-in.

FossilOrigin-Name: 5cf9ea9b1fff4625a50a2343d0fd3812da6612d6b24c07e10edb6c1ff03ca2df
2024-01-23 21:10:01 +00:00
dan
bcf3df0192 In os_unix.c and os_win.c, do not allow xFetch() to return a pointer to a page buffer that is right at the end of the mapped region - if the database is corrupted in a specific way such a page buffer might be overread by several bytes.
FossilOrigin-Name: 2684feac3bc9c5463604900d72710be861527614f4957224c74a16a3b3c702f5
2024-01-23 16:09:22 +00:00
drh
1ff9a7bc8d Improved error message when a double-quoted identifier name cannot be
resolved - ask the user if they intended to use a string literal.

FossilOrigin-Name: efc5c3c5e6ae1f9f0be61ea4ce7b3e34f3dc318791c78e0f4bebebeaccf6951e
2024-01-23 14:45:22 +00:00
drh
5ff513c16e When a JSON input is a blob, but it looks like valid JSON when cast to text,
then accept it as valid JSON.  This replicates a long-standing bug in the
behavior of JSON routines, and thus avoids breaking legacy apps.
[forum:/forumpost/012136abd5292b8d|Forum thread 012136abd5292b8d].

FossilOrigin-Name: e5dc81d5c7ee97866feb688dfa9b6fc225dabff2b020b9b96b49a8fea5640aec
2024-01-23 13:51:55 +00:00
drh
6bb8ce6375 Fix typo in the tag-20240123-a in a comment.
FossilOrigin-Name: 1f09541eb4203ccce476f6040ff134353850f22f07fb84f96a1d2c27b304a91b
2024-01-23 13:28:21 +00:00
drh
e318f10ce2 If a BLOB looks like JSON when cast to text, then treat it as if it really
were JSON.  This replicates a long-standing bug in the JSON processing
routines, and thereby avoids breaking legacy.

FossilOrigin-Name: d79a37690ce7ebb91df203170d73511da44546328043c2b3fe1786b2f0087093
2024-01-23 13:21:40 +00:00
stephan
91cee17d83 Change the shell's --help flag to exit with code 0 instead of 1, per /forum and /chat discussions.
FossilOrigin-Name: df563a18578c5cf1aaecf5818c93967aaa70475598d3c099779622ac8911f926
2024-01-23 12:51:17 +00:00
drh
727b35cbfc Simplification of the error reporting logic.
FossilOrigin-Name: 59eb9d29e796886db17a578b64e75fd2797aebf969cbeeda70ecf2fda378c98f
2024-01-22 20:49:47 +00:00
drh
a67d63b481 Improved error message when a double-quoted string is used and it seems likely
that the user wanted a single-quoted string literal.

FossilOrigin-Name: 0a834bd81122b6e9c34c8253f9e45d53dab3274be28df60968366fa42237617b
2024-01-22 15:26:33 +00:00
drh
41fb2eed07 The -DSQLITE_JSON_BLOB_INPUT_BUG_COMPATIBLE compile-time option causes blob
inputs to JSON functions that are not JSONB to be processed as if they
where text, immulating historical bugging behavior which some applications
have come to rely upon.  See
[forum:/forumpost/012136abd5292b8d|forum thread 012136abd5292b8d] for
discussion.

FossilOrigin-Name: 65572223583d43e1d61ec029641f9d3ff340e68ecfba8342c8d1b0a91a680f2a
2024-01-22 14:16:10 +00:00
dan
b4b7088d5f Fix test script literal.test so that it works with SQLITE_OMIT_ALTER_TABLE builds.
FossilOrigin-Name: 4dc00f577632c7b13135505007804d42a12f81a9ebd58d4c380727256b054b7e
2024-01-22 14:01:07 +00:00
drh
776fe42c70 Fix userauth so that it works together with SQLITE_OMIT_SHARED_CACHE.
([forum:/forumpost/0bfc5888a384d430|Forum post 0bfc5888a384d430]).
However, also change to code to issue a deprecation warning whenever
SQLITE_USER_AUTHENTICATION is used.

FossilOrigin-Name: 249048b0cbc37058c229a785182e07b46029584aff9c385269b0b93503153476
2024-01-22 12:56:58 +00:00
drh
3b799b0fca Add a notice to the user-authentication documentation to say that the
extension is deprecated and may disappear in the future.

FossilOrigin-Name: fe6fc7b91ad1771a2d2d4e3d9d60831b3056d528a700932bf11a336c7e3414a2
2024-01-22 12:30:17 +00:00
larrybr
05ab0f72c3 Make CLI .dump immune to pragma reverse_unordered_selects, as reported in [forum:/forumpost/c42be01880e961eb|Forum thread "Missing ORDER BY in .dump?"]
FossilOrigin-Name: 488caed24453fcef6fddcf40353e3b44cf37fb9d21e0ed743d39d60cbff020a7
2024-01-22 01:11:24 +00:00