Skip to content

Commit 41b0239

Browse files
committed
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 0785d1b. Zero-initialize the whole struct. Author: Jacob Champion <[email protected]> Reported-by: Alexander Lakhin <[email protected]> Discussion: https://www.postgresql.org/message-id/CAOYmi+n9QWr4gsAADZc6qFQjFViXQYVk=gBy_EvxuqsgPJcb_g@mail.gmail.com
1 parent 342fb8a commit 41b0239

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/common/jsonapi.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1536,7 +1536,7 @@ json_lex(JsonLexContext *lex)
15361536
jsonapi_StrValType *ptok = &(lex->inc_state->partial_token);
15371537
size_t added = 0;
15381538
bool tok_done = false;
1539-
JsonLexContext dummy_lex;
1539+
JsonLexContext dummy_lex = {0};
15401540
JsonParseErrorType partial_result;
15411541

15421542
if (ptok->data[0] == '"')

0 commit comments

Comments
 (0)