1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-09 14:21:03 +03:00

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
This commit is contained in:
drh
2023-08-30 18:19:40 +00:00
parent 7bb5a6db40
commit a7ec1f9a1b
4 changed files with 14 additions and 9 deletions

View File

@@ -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;