drh
b4e7d59f4f
Add the json_pretty(J) function for pretty-printing of JSON. An optional
...
2nd argument is text used for indentation, with a default value being four
spaces.
FossilOrigin-Name: 39552bd36c06fe9ee346cb71e0659baceccde031b67c0974f2dd14eb11ebc055
2024-03-06 14:30:42 +00:00
drh
28001204f4
The value returned by the json_each.json field needs to survive longer than
...
the json_each virtual table itself, in the event that the value is used in
an aggregate expression. dbsqlfuzz 5120bd0b3bb0b73eebbcb79ac37c6b0663fccad6
FossilOrigin-Name: 952ed71b9b61e79fe807ac3134bdfa7c94a415e02f13f94440a34d6d548d171e
2024-03-05 16:47:48 +00:00
mistachkin
f7ad684c5a
Fix harmless compiler warning seen with MSVC.
...
FossilOrigin-Name: e5db08993127dfc18cc2b621a13cbfef52974f0f504f4d8208093bfad1ffdcc5
2024-02-22 18:15:08 +00:00
drh
4dd59fd997
Fix the subtype on the value column from json_each/json_tree for cases
...
when the value is an array or object. Fix for the bug reported by
[forum:/forumpost/ecb94cd210|forum post ecb94cd210].
FossilOrigin-Name: 1c33c5db2e05019d1a375109f79ad8588a3c17f81e4f4b8d66c880c3c860e87e
2024-02-16 21:30:08 +00:00
drh
71cdea8f5f
Detect and respond to an OOM on the jsonStringTerminate() call of
...
jsonReturnStringAsBlob() routine.
FossilOrigin-Name: 881f814c09b6896a448a2360b0b43dc99592ea3a1d72ac359770cbb0a2c7d38a
2024-02-07 14:05:38 +00:00
drh
8babc01892
Slight change to OOM handling in JSON to catch a corner case found by
...
dbsqlfuzz.
FossilOrigin-Name: 6a2b3266c586d12b51e11fe63cda5881be9373207aa16671ab77f547830eb790
2024-02-06 18:33:01 +00:00
mistachkin
3ab9c021ff
Fix harmless compiler warnings seen with MSVC.
...
FossilOrigin-Name: e52c87420b072fa68d921eda66069542d50accbfaf1110ac4cc1543a4162200d
2024-02-04 04:01:11 +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
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
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
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
drh
777a08893b
When backing out a character in a constructed string in JSON, first make sure
...
the string has not been reset by on OOM.
dbsqlfuzz 2fffbea91a5376526ea118d4fe4188c8dd35e317.
FossilOrigin-Name: 666690eb433fe38fa527ccbbb8e2c00041a33939da4f6b8bfb737d664f28f0d8
2024-01-20 12:13:00 +00:00
drh
6ad928d91d
Clutter the code with "fall-through" comments in order to suppress nuisance
...
compiler warnings. No logic changes.
FossilOrigin-Name: 05d2cf5e90d2a6b8e7fbcdb9e12e7c1281db7cfbe212997bd63c8aa66797edda
2024-01-16 15:04:19 +00:00
drh
4093b29610
Convert the JSON functions to use lookaside memory allocation whenever
...
feasible, to avoid hitting the global memory allocator mutex.
FossilOrigin-Name: a79a244954f728596da3c0e28fa3b887258d1bd831f53881970f418f3fba84c7
2024-01-03 16:41:50 +00:00
drh
4c13d3ca92
Performance improvement by unwinding a loop in jsonAppendString().
...
FossilOrigin-Name: 190ab3c08431a0ba24d76392eab251f5c1792add05e4ec780998b299208eca95
2023-12-28 19:18:08 +00:00
drh
0546a284fa
Enhance the (undocumented, debug-only) json_parse() SQL function so that it
...
returns the text rendering of the JSONB parse of the input, rather than printing
the rendering on stdout.
FossilOrigin-Name: 056de8d551dcbdf1d162e2db15ed418fa9c786f900cd3972ef8a1dea3f4f3aa1
2023-12-28 16:21:22 +00:00
drh
b2b7490862
Improved handling of malformed unicode within JSON strings.
...
FossilOrigin-Name: e252bdf5f5de26ba8e2bcc6b0ad94121ed6fc4d86c02fe4a2a058ada93747beb
2023-12-26 13:20:57 +00:00
drh
c2eff91bd3
Add internal core-developer-only documentation of the JSONB format.
...
FossilOrigin-Name: 4d30478863b2a60512010de9ec6e3099bfaf75d4afee20acec536713fe94334d
2023-12-21 18:08:05 +00:00
drh
3262ca83a7
In JSON - minor code cleanup and refactoring with a small size reduction
...
and performance increase.
FossilOrigin-Name: 215fabda38daecdbd38b1eca5a6aafbc61b6a36a8303f1d7164d5a1138e63134
2023-12-19 21:39:58 +00:00
drh
459f7b1090
Remove a stray comment in the JSON code.
...
FossilOrigin-Name: 6618bdf0679405b43911ea8cd94050b12a5dc469f3dfe4759ee3ff850a55229e
2023-12-19 00:07:38 +00:00
drh
c4dd6b42ec
Add NEVER() to an unfalsifiable branch.
...
FossilOrigin-Name: 9a0c67db366d38a0b0741f6a1ae333cf27cfe6f6b7c6eed94bdec9686f9f9f8a
2023-12-18 18:50:47 +00:00
drh
fc76750f61
Fix JSON to JSONB translation so that it deals correctly with Infinity
...
and NaN.
FossilOrigin-Name: 178cb84f36bdb45ba17511900d6d8ea8dfa14912fc5bf7094a20348174a36c95
2023-12-18 18:31:27 +00:00
drh
095f2c5082
Ensure that the insert/delete size delta on JSONB objects in the JSON cache
...
are always set to zero.
FossilOrigin-Name: 4b4581668a908473dbf1322a3e98bc7cca122998c44518ea183af7f0d1ba9f95
2023-12-18 15:53:48 +00:00
drh
4a5c96ace3
Fix harmless compiler warnings in JSON and FTS5.
...
FossilOrigin-Name: 90135efccfeb1046f002bfcbd8dfec9a1a3b40cbe1b5c714ae065b06368e354f
2023-12-14 15:38:57 +00:00
drh
f7c78a2408
Bug fix in the JSONB validator.
...
dbsqlfuzz ac6fa521a08609a642198e7decf64180e750b3c4
FossilOrigin-Name: 3e940a6a08b0a0434650cd3d8dd286e09ad8ab805b0a4d515e57bba5d3608577
2023-12-13 15:27:03 +00:00
drh
001d1e795c
Improvements to UTF8 handling, and especially the handling of invalid UTF8,
...
in the JSON routines.
FossilOrigin-Name: 1b229c1101d6c384a30f343c5e47b471ab084b2d8e81170eb8f642afc1c67e3b
2023-12-13 14:31:15 +00:00
drh
891f1dc054
Fix the JSON object label comparison object so that it works correctly even
...
if the label ends with escaped whitespace.
FossilOrigin-Name: 4d5353cadd7b7c5f105bc197f3ec739e2d041472d6b3e939654c9f9cfc2749ae
2023-12-12 18:38:53 +00:00
drh
78e636bba6
Add NEVER to two unreachable branches in JSON.
...
FossilOrigin-Name: c96ebb086feb89341565cc52b970ae7799ce1327fe1ad4fc790f1b0dcaa6e229
2023-12-12 17:13:10 +00:00
drh
87399a56db
Improvements to JSONB validation - catch more cases where the input does
...
not conform to spec.
FossilOrigin-Name: be1864eac4eb75cc30bf98f73092c8608467f4bd956240df6a0cbea9f1e09e85
2023-12-12 14:33:52 +00:00
drh
cc1a39fd24
Validity checking of text nodes in JSONB.
...
FossilOrigin-Name: fa5160687c2f970d407e8af73c246f7cd806bb4ce35f29a79ac534a8646a6c8e
2023-12-12 02:31:12 +00:00
drh
ad6bc61804
The json_error_position() function now reports an approximate byte offset
...
to the problem in a JSONB if there is a problem.
FossilOrigin-Name: 80d5d94dff6a2d2557039be3d7d47c1a6003c4b98defe0bd411acfeb963ad5dd
2023-12-11 21:00:55 +00:00
drh
5a890b4ed2
json_error_position() now uses jsonValidityCheck() to find the approximate
...
position of an error in a JSONB blob.
FossilOrigin-Name: c3d60cf7028a333b825d5b89516945a73e0c158ac81d8bcc117d21bfd98602c8
2023-12-11 20:44:21 +00:00
drh
001caa714f
json_valid(*,8) allows minus-signs on hexadecimal literals.
...
FossilOrigin-Name: c0d7f4520d839a268b3fd2474d0897a9832aa608bd6238b3e287fabecf07a350
2023-12-11 20:19:10 +00:00
drh
ba5505657f
Rename the new test-control to SQLITE_TESTCTRL_JSON_SELFCHECK. Make it so
...
that the current value of the setting can be interrogated.
FossilOrigin-Name: 7aff1d9a4cb17ecd5abab21ab032f35a78741dd641ddd8cbcc85fc4a81a0707d
2023-12-11 19:00:44 +00:00
drh
7d2eaae83e
Add SQLITE_TESTCTRL_VALIDATE_JSONB, which if enabled under SQLITE_DEBUG causes
...
cross-checking of generate JSONB.
FossilOrigin-Name: b410a4db74a650003539ffaaea18519d5159b504daac47db6a4874b730f40ac8
2023-12-11 17:03:12 +00:00
drh
ce46e0eb11
Work toward enhanced functionality for json_valid() with deep checking
...
of the JSONB (second argument has bit 0x08).
FossilOrigin-Name: c370d573198b151767f04e91bf8baa4ae0076751ae468c5709742a0b0ed16770
2023-12-11 14:01:38 +00:00
drh
b89e64d822
Fix a potential use of uninitialized value in json_valid() with 2nd
...
argument of 8.
FossilOrigin-Name: fa102036fe46eeb71b7df3e265be1935ae5c78e0b939b08841bcfb8abadbc77a
2023-12-11 02:39:11 +00:00
drh
bfa0de86e6
Fix a harmless UBSAN warning.
...
FossilOrigin-Name: 1503cba6d17e9bade7a5c103ddd23241ff4741f9a2e3032ffe2987af243dae65
2023-12-08 16:56:50 +00:00
drh
2a27be2107
Fix a potential problem RCStr access on a JsonString object that is not
...
really and RCStr. Fuzzer/UBSAN find.
FossilOrigin-Name: d2f2174ce2cc89606034e158149a2d05fc3627ec4d5cdb772add7a2250f29d78
2023-12-08 14:54:22 +00:00
drh
5a238ffcae
Rework the jsonEachPathLength() routine in json_tree() so that it is
...
less susceptible to problems due to goofy object labels.
FossilOrigin-Name: 858b76a00e8ff55215f7a2e6a4cd77fc4d4f98dea7224cd90488744f5ce246a4
2023-12-07 14:09:25 +00:00
drh
5b6b703461
Improved detection of corrupt JSONB in the jsonReturnFromBlob() function.
...
FossilOrigin-Name: b014736c1f80ccc46fb4b24ac04310a6ce5cb5b6653665efff366cb3bc742257
2023-12-07 12:55:39 +00:00
drh
a9c8469d03
Do correct comparisons between object labels in JSON even when the two labels
...
contain different JSON escapes.
FossilOrigin-Name: bda2e30cc22e180b19a7a05824dd345880eb402ae5450b2d2dd954946c3ae135
2023-12-06 17:50:16 +00:00
drh
b597fea894
Correctly handle 8-byte sizes in the JSONB format.
...
[forum:/forumpost/283daf08e91183fc|Forum post 283daf08e91183fc].
FossilOrigin-Name: 73d390f39c0bbbc017e01544e4d43c76761f2599bd57f900131c706270dfd202
2023-12-06 17:39:31 +00:00