mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-11 01:42:22 +03:00
Remove some unnecessary code. Report errors for invalid JSONB input on
an extract. FossilOrigin-Name: cbea16c29eb0507f39b5a1cf744a3bb9bb7c71ac156e84a19d03a37cb1816891
This commit is contained in:
12
manifest
12
manifest
@@ -1,5 +1,5 @@
|
||||
C The\sreturn\sfrom\ssqlite3_value_blob()\sin\sjsonFuncArgMightBeBinary()\smight\nbe\sa\sNULL\spointer.\s\sCheck\sfor\sthat\scase.
|
||||
D 2023-10-07T19:46:22.897
|
||||
C Remove\ssome\sunnecessary\scode.\s\sReport\serrors\sfor\sinvalid\sJSONB\sinput\son\nan\sextract.
|
||||
D 2023-10-07T23:35:07.967
|
||||
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
|
||||
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
|
||||
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
|
||||
@@ -670,7 +670,7 @@ F src/hash.h 3340ab6e1d13e725571d7cee6d3e3135f0779a7d8e76a9ce0a85971fa3953c51
|
||||
F src/hwtime.h f9c2dfb84dce7acf95ce6d289e46f5f9d3d1afd328e53da8f8e9008e3b3caae6
|
||||
F src/in-operator.md 10cd8f4bcd225a32518407c2fb2484089112fd71
|
||||
F src/insert.c 3f0a94082d978bbdd33c38fefea15346c6c6bffb70bc645a71dc0f1f87dd3276
|
||||
F src/json.c 6b0c502122ad2e306888e2c32eebd8c5b46c36e6b6f3ae1662c81e4a26d48410
|
||||
F src/json.c e97d03f1c19e403bfe0f0a1deaf50b3e3d657bb8addd5dfe7f9dcf72bcfa3109
|
||||
F src/legacy.c d7874bc885906868cd51e6c2156698f2754f02d9eee1bae2d687323c3ca8e5aa
|
||||
F src/loadext.c 98cfba10989b3da6f1807ad42444017742db7f100a54f1032af7a8b1295912c0
|
||||
F src/main.c 618aeb399e993cf561864f4b0cf6a331ee4f355cf663635f8d9da3193a46aa40
|
||||
@@ -2124,8 +2124,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
|
||||
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
|
||||
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
|
||||
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
|
||||
P ed99a788415e1f8375bd5ec004dd18b1cd0fae4aa94558170882ca487f6dff93
|
||||
R d7e7cc74e75e3ba90c541936a8c94fd0
|
||||
P 7b52b266b066f1385144c1103a3a411306db5f44568366ae1e93cd8cce799bbc
|
||||
R 878d86e1e87a30f2fb868ea5f585d29f
|
||||
U drh
|
||||
Z 327a5a9c0b0e46cc41c5ed6d2b8be3ed
|
||||
Z 509d9208ad89eff1e0f2ca5c213ed021
|
||||
# Remove this line to create a well-formed Fossil manifest.
|
||||
|
||||
@@ -1 +1 @@
|
||||
7b52b266b066f1385144c1103a3a411306db5f44568366ae1e93cd8cce799bbc
|
||||
cbea16c29eb0507f39b5a1cf744a3bb9bb7c71ac156e84a19d03a37cb1816891
|
||||
20
src/json.c
20
src/json.c
@@ -2800,9 +2800,7 @@ json_parse_restart:
|
||||
pParse->iErr = j;
|
||||
return -1;
|
||||
}
|
||||
if( pParse->oom==0 ){
|
||||
jsonBlobChangePayloadSize(pParse, iThis, pParse->nBlob - iStart);
|
||||
}
|
||||
jsonBlobChangePayloadSize(pParse, iThis, pParse->nBlob - iStart);
|
||||
pParse->iDepth--;
|
||||
return j+1;
|
||||
}
|
||||
@@ -2854,9 +2852,7 @@ json_parse_restart:
|
||||
pParse->iErr = j;
|
||||
return -1;
|
||||
}
|
||||
if( pParse->oom==0 ){
|
||||
jsonBlobChangePayloadSize(pParse, iThis, pParse->nBlob - iStart);
|
||||
}
|
||||
jsonBlobChangePayloadSize(pParse, iThis, pParse->nBlob - iStart);
|
||||
pParse->iDepth--;
|
||||
return j+1;
|
||||
}
|
||||
@@ -3855,12 +3851,7 @@ static void jsonReturnTextJsonFromBlob(
|
||||
x.nBlob = nBlob;
|
||||
jsonStringInit(&s, ctx);
|
||||
jsonRenderBlob(&x, 0, &s);
|
||||
if( x.nErr ){
|
||||
sqlite3_result_error(ctx, "malformed JSON", -1);
|
||||
jsonStringReset(&s);
|
||||
}else{
|
||||
jsonReturnString(&s);
|
||||
}
|
||||
jsonReturnString(&s);
|
||||
}
|
||||
|
||||
|
||||
@@ -3903,7 +3894,6 @@ static void jsonReturnFromBlob(
|
||||
int bNeg = 0;
|
||||
char x = (char)pParse->aBlob[i+n];
|
||||
if( x=='-' && ALWAYS(sz>0) ){ n++; sz--; bNeg = 1; }
|
||||
else if( x=='+' && ALWAYS(sz>0) ){ n++; sz--; }
|
||||
z = sqlite3DbStrNDup(db, (const char*)&pParse->aBlob[i+n], (int)sz);
|
||||
if( z==0 ) return;
|
||||
rc = sqlite3DecOrHexToI64(z, &iRes);
|
||||
@@ -4031,6 +4021,10 @@ static void jsonReturnFromBlob(
|
||||
}
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
sqlite3_result_error(pCtx, "malformed JSON", -1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user