diff options
author | drh <> | 2023-08-30 18:19:40 +0000 |
---|---|---|
committer | drh <> | 2023-08-30 18:19:40 +0000 |
commit | a7ec1f9a1b0415336079baa9a6073d37350c8331 (patch) | |
tree | a29470dec997162068ab96ee2d086224aa9824d1 /src/json.c | |
parent | 7bb5a6db4036e3956aadb71be0c390d3a4c32243 (diff) | |
download | sqlite-a7ec1f9a1b0415336079baa9a6073d37350c8331.tar.gz sqlite-a7ec1f9a1b0415336079baa9a6073d37350c8331.zip |
Fix a bug in json_array_length() introduced in version 3.43.0 by
check-in [df099ad713011b67]. If the JSON input comes from json_remove(),
the removed array entries are still counted as part of the array length.
FossilOrigin-Name: 69a635958a4a14187e88dd297df8978a4805b1b0c7bff3ec29d5632c0f68d889
Diffstat (limited to 'src/json.c')
-rw-r--r-- | src/json.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/json.c b/src/json.c index f8d4aa2a7..253fce9f4 100644 --- a/src/json.c +++ b/src/json.c @@ -2484,7 +2484,9 @@ static void jsonArrayLengthFunc( } if( pNode->eType==JSON_ARRAY ){ while( 1 /*exit-by-break*/ ){ - for(i=1; i<=pNode->n; n++){ + i = 1; + while( i<=pNode->n ){ + if( (pNode[i].jnFlags & JNODE_REMOVE)==0 ) n++; i += jsonNodeSize(&pNode[i]); } if( (pNode->jnFlags & JNODE_APPEND)==0 ) break; |