json: fix code that could have a side-effects - json2tsv - JSON to TSV converter
(HTM) git clone git://git.codemadness.org/json2tsv
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit e889775a6c3962a1d043c5316beb956cd8f0cb05
(DIR) parent 5c614ee9fef3c53e5c046b5fc2af19253a2899b5
(HTM) Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Fri, 12 Nov 2021 11:22:48 +0100
json: fix code that could have a side-effects
It found a bug in the scc compiler.
Diffstat:
M json.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
---
(DIR) diff --git a/json.c b/json.c
@@ -246,7 +246,8 @@ escchr:
(c == '}' && nodes[depth - 1].type != JSON_TYPE_OBJECT))
JSON_INVALID(); /* unbalanced nodes */
- nodes[--depth].index++;
+ depth--;
+ nodes[depth].index++;
expect = EXPECT_END;
break;
case ',':