aboutsummaryrefslogtreecommitdiff
path: root/src/json.c
diff options
context:
space:
mode:
authordrh <>2023-07-24 23:27:05 +0000
committerdrh <>2023-07-24 23:27:05 +0000
commitb715fe9d80b3656fd0afb82847932e6592306609 (patch)
tree5e0193dc9a108cd35376287ee2cc62c5bbce3354 /src/json.c
parent3d2a559ecb5087f554c36344ca790fb8f4502f2e (diff)
downloadsqlite-b715fe9d80b3656fd0afb82847932e6592306609.tar.gz
sqlite-b715fe9d80b3656fd0afb82847932e6592306609.zip
It is an error to try to insert a BLOB value into JSON.
FossilOrigin-Name: 28c6e964b1e2257527df02b352f02e135f7c4b764b8b41eda6461f9538f5d042
Diffstat (limited to 'src/json.c')
-rw-r--r--src/json.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/json.c b/src/json.c
index 217c1070c..0ce68f1fc 100644
--- a/src/json.c
+++ b/src/json.c
@@ -733,10 +733,12 @@ static void jsonReturnJson(
sqlite3_result_error_nomem(pCtx);
return;
}
- jsonInit(&s, pCtx);
- jsonRenderNode(pParse, pNode, &s);
- jsonResult(&s);
- sqlite3_result_subtype(pCtx, JSON_SUBTYPE);
+ if( pParse->nErr==0 ){
+ jsonInit(&s, pCtx);
+ jsonRenderNode(pParse, pNode, &s);
+ jsonResult(&s);
+ sqlite3_result_subtype(pCtx, JSON_SUBTYPE);
+ }
}
/*
@@ -2705,6 +2707,11 @@ static void jsonReplaceNode(
}
break;
}
+ case SQLITE_BLOB: {
+ sqlite3_result_error(pCtx, "JSON cannot hold BLOB values", -1);
+ p->nErr++;
+ break;
+ }
}
}