From d3e639ba2bacf64fc0d2eb3aa9364a87030335f5 Mon Sep 17 00:00:00 2001 From: Jacob Champion Date: Mon, 7 Oct 2024 14:41:31 -0700 Subject: [PATCH v4 2/2] jsonapi: fully initialize dummy lexer Valgrind reports that checks on lex->inc_state are undefined for the "dummy lexer" used for incremental parsing, since it's only partially initialized on the stack. This was introduced in 0785d1b8b2. Zero-initialize the whole struct. --- src/common/jsonapi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/jsonapi.c b/src/common/jsonapi.c index df6e633b5e..0e2a82ad7a 100644 --- a/src/common/jsonapi.c +++ b/src/common/jsonapi.c @@ -1622,7 +1622,7 @@ json_lex(JsonLexContext *lex) jsonapi_StrValType *ptok = &(lex->inc_state->partial_token); size_t added = 0; bool tok_done = false; - JsonLexContext dummy_lex; + JsonLexContext dummy_lex = {0}; JsonParseErrorType partial_result; if (ptok->data[0] == '"') -- 2.34.1