From: Daniel Axtens <dja@axtens.net>
To: grub-devel@gnu.org
Cc: Daniel Axtens <dja@axtens.net>
Subject: [PATCH 2/2] gzio: Properly init a table
Date: Mon, 13 May 2024 00:32:09 +1000 [thread overview]
Message-ID: <20240512143209.44357-3-dja@axtens.net> (raw)
In-Reply-To: <20240512143209.44357-1-dja@axtens.net>
ARRAY_SIZE is the count of elements, but the element size is 4 bytes, so
this was only initing the first 1/4th of the table. Detected with valgrind.
This should only matter in error paths, and I've not been able to identify
any actual misbehaviour that results from reading in-bounds but uninited data.
---
grub-core/io/gzio.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/grub-core/io/gzio.c b/grub-core/io/gzio.c
index 8f23a1705..7f7985214 100644
--- a/grub-core/io/gzio.c
+++ b/grub-core/io/gzio.c
@@ -522,7 +522,7 @@ huft_build (unsigned *b, /* code lengths in bits (all assumed <= BMAX) */
}
/* Make a table of values in order of bit lengths */
- grub_memset (v, N_MAX, ARRAY_SIZE (v));
+ grub_memset (v, N_MAX, sizeof (v));
p = b;
i = 0;
do
--
2.39.3 (Apple Git-145)
_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel
next prev parent reply other threads:[~2024-05-12 14:33 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-12 14:32 [PATCH 0/2] Two small fixes to gzip Daniel Axtens
2024-05-12 14:32 ` [PATCH 1/2] gzio: abort early when get_byte reads nothing Daniel Axtens
2024-05-12 14:32 ` Daniel Axtens [this message]
2024-05-17 10:29 ` [PATCH 0/2] Two small fixes to gzip Daniel Kiper
2024-05-18 4:52 ` Daniel Axtens
2024-05-20 16:58 ` Daniel Kiper
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240512143209.44357-3-dja@axtens.net \
--to=dja@axtens.net \
--cc=grub-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).