On Tue, Oct 15, 2024 at 11:00 AM Alexander Lakhin <exclus...@gmail.com> wrote:
> I've discovered that starting from 0785d1b8b,
> make check -C src/bin/pg_combinebackup
> fails under Valgrind, with the following diagnostics:

Yep, sorry for that (and thanks for the report!). It's currently
tracked over at [1], but I should have mentioned it here. The patch I
used is attached, renamed to not stress out the cfbot.

--Jacob

[1] 
https://www.postgresql.org/message-id/CAOYmi%2BkiiM83%3DH6YQ77NSSCtkGAzAnZfC0vZS%3DaLM9QZx%3DRn_A%40mail.gmail.com
From d3e639ba2bacf64fc0d2eb3aa9364a87030335f5 Mon Sep 17 00:00:00 2001
From: Jacob Champion <jacob.champ...@enterprisedb.com>
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

Reply via email to