aboutsummaryrefslogtreecommitdiff
path: root/src/json.c
diff options
context:
space:
mode:
authordrh <>2023-08-11 11:12:46 +0000
committerdrh <>2023-08-11 11:12:46 +0000
commit91c009291756e7e7fa338f8f28335a3d2f3bc3ea (patch)
tree62a948a5e113d473922ca7e2a7dca872cd7753a0 /src/json.c
parent89e1caf294e50ccbbc94cb75ba8a21c41aeb160c (diff)
downloadsqlite-91c009291756e7e7fa338f8f28335a3d2f3bc3ea.tar.gz
sqlite-91c009291756e7e7fa338f8f28335a3d2f3bc3ea.zip
Up until version 3.42.0, there was a bug in json_valid() such that it would
return False (0) for a NULL input. That bug is fixed in 3.42.0. This check-in adds a compile-time option -DSQLITE_LEGACY_JSON_VALID that restores the old buggy behavior for applications that depend on it. FossilOrigin-Name: 15c2eadbff8e732cca45d6c3771d1fcea5aab2127e87f2a611b41ccfef4d1a0d
Diffstat (limited to 'src/json.c')
-rw-r--r--src/json.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/json.c b/src/json.c
index fcaa9d84b..f8d4aa2a7 100644
--- a/src/json.c
+++ b/src/json.c
@@ -3009,7 +3009,13 @@ static void jsonValidFunc(
){
JsonParse *p; /* The parse */
UNUSED_PARAMETER(argc);
- if( sqlite3_value_type(argv[0])==SQLITE_NULL ) return;
+ if( sqlite3_value_type(argv[0])==SQLITE_NULL ){
+#ifdef SQLITE_LEGACY_JSON_VALID
+ /* Incorrect legacy behavior was to return FALSE for a NULL input */
+ sqlite3_result_int(ctx, 0);
+#endif
+ return;
+ }
p = jsonParseCached(ctx, argv[0], 0, 0);
if( p==0 || p->oom ){
sqlite3_result_error_nomem(ctx);