diff mbox series

[jsonpath] main: fix array parsing

Message ID 20210520194450.345112-1-mikma.lowo@lists.m7n.se
State New
Headers show
Series [jsonpath] main: fix array parsing | expand

Commit Message

Mikael Magnusson May 20, 2021, 7:44 p.m. UTC
From: Mikael Magnusson <mikma@users.sourceforge.net>

Don't stop array parsing if the chunk happens to end at an object boundary.

Fixes FS#3683: jsonfilter yields unreliable results

Signed-off-by: Mikael Magnusson <mikma@users.sourceforge.net>
---
 main.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/main.c b/main.c
index 5041d10..1e3665e 100644
--- a/main.c
+++ b/main.c
@@ -146,8 +146,12 @@  parse_json(FILE *fd, const char *source, const char **error, bool array_mode)
 		{
 			obj = parse_json_chunk(tok, array, buf, len, &err);
 
-			if (err == json_tokener_success && !array)
-				break;
+			if (err == json_tokener_success) {
+				if (!array)
+					break;
+				else
+					continue;
+			}
 
 			if (err != json_tokener_continue)
 				break;