public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
From: Mark Wielaard <mark@klomp.org>
To: Aleksei Vetrov <vvvvvv@google.com>
Cc: elfutils-devel@sourceware.org, kernel-team@android.com,
	maennich@google.com
Subject: Re: [PATCH] libelf: check decompressed ZSTD size
Date: Fri, 24 Nov 2023 00:32:13 +0100	[thread overview]
Message-ID: <20231123233213.GG5263@gnu.wildebeest.org> (raw)
In-Reply-To: <20231123153147.537151-1-vvvvvv@google.com>

Hi Aleksei,

On Thu, Nov 23, 2023 at 03:31:47PM +0000, Aleksei Vetrov wrote:
> Decompression functions like __libelf_decompress_zlib check that
> decompressed data has the same size as it was declared in the header
> (size_out argument). The same check is now added to
> __libelf_decompress_zstd to make sure that the whole allocated buffer is
> initialized.
> 
>     * libelf/elf_compress.c (__libelf_decompress_zstd): Use return value
>       of ZSTD_decompress to check that decompressed data size is the
>       same as size_out of the buffer that was allocated.

Thanks, this makes sense. If the decompressed size isn't what was
encoded in the Chdr then we could reduce the size of the d_buf/d_size,
but that probably is not what the user expects. Flagging it as
bad/inconsistent data makes sense. Especially since we do the same for
zlib compressed data.

Pushed,

Mark

      reply	other threads:[~2023-11-23 23:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-23 15:31 Aleksei Vetrov
2023-11-23 23:32 ` Mark Wielaard [this message]

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=20231123233213.GG5263@gnu.wildebeest.org \
    --to=mark@klomp.org \
    --cc=elfutils-devel@sourceware.org \
    --cc=kernel-team@android.com \
    --cc=maennich@google.com \
    --cc=vvvvvv@google.com \
    /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).