[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [SECURITY PATCH 029/117] zstd: Initialize seq_t structure fully

From: Paul Menzel
Subject: Re: [SECURITY PATCH 029/117] zstd: Initialize seq_t structure fully
Date: Thu, 18 Mar 2021 09:50:00 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.0

Dear Darren, dear Daniel,

Am 02.03.21 um 19:00 schrieb Daniel Kiper:
From: Darren Kenny <>

While many compilers will initialize this to zero, not all will,

Which ones do not?

so it is better to be sure that fields not being explicitly set are at known
values, and there is code that checks this fields value elsewhere in the

Fixes: CID 292440

What is the exact error? Is there a code flow, where one element does not get set. (The commit message would be incorrect if this is not the case.)

Lastly, this is imported from upstream. I created an issue upstream [1].

Signed-off-by: Darren Kenny <>
Reviewed-by: Daniel Kiper <>
  grub-core/lib/zstd/zstd_decompress.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/grub-core/lib/zstd/zstd_decompress.c 
index 711b5b6d7..e4b5670c2 100644
--- a/grub-core/lib/zstd/zstd_decompress.c
+++ b/grub-core/lib/zstd/zstd_decompress.c
@@ -1325,7 +1325,7 @@ typedef enum { ZSTD_lo_isRegularOffset, 
ZSTD_lo_isLongOffset=1 } ZSTD_longOffset
  ZSTD_decodeSequence(seqState_t* seqState, const ZSTD_longOffset_e longOffsets)
-    seq_t seq;
+    seq_t seq = {0};
      U32 const llBits = 
      U32 const mlBits = 
      U32 const ofBits = 

I once read, that compilers cannot warn you, if you miss setting an element if you initialize structures to 0 in the beginning.

Kind regards,



reply via email to

[Prev in Thread] Current Thread [Next in Thread]