1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-11 01:42:22 +03:00

Do not allow the same JSON parse to be input to both arguments to the

json_patch() routine.

FossilOrigin-Name: 8e781c6742792b3899ca60efc49c7eaee1df9f6b03d27c254b0e148b82946e19
This commit is contained in:
drh
2023-07-28 20:59:25 +00:00
parent 58b5921ca4
commit 3e053c50b4
4 changed files with 10 additions and 10 deletions

View File

@@ -2672,10 +2672,11 @@ static void jsonPatchFunc(
UNUSED_PARAMETER(argc);
pX = jsonParseCached(ctx, argv[0], ctx, 1);
if( pX==0 ) return;
assert( pX->hasMod==0 );
pX->hasMod = 1;
pY = jsonParseCached(ctx, argv[1], ctx, 1);
if( pY==0 ) return;
pX->useMod = 1;
pX->hasMod = 1;
pY->useMod = 1;
pResult = jsonMergePatch(pX, 0, pY->aNode);
assert( pResult!=0 || pX->oom );