public inbox for binutils-cvs@sourceware.org
 help / color / mirror / Atom feed
* [binutils-gdb] Sanity check section size in bfd_init_section_compress_status
@ 2023-03-29  2:50 Alan Modra
  0 siblings, 0 replies; only message in thread
From: Alan Modra @ 2023-03-29  2:50 UTC (permalink / raw)
  To: bfd-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=aec101ab06697221d2bc2f82b3a65fb92054ed9f

commit aec101ab06697221d2bc2f82b3a65fb92054ed9f
Author: Alan Modra <amodra@gmail.com>
Date:   Wed Mar 29 12:45:16 2023 +1030

    Sanity check section size in bfd_init_section_compress_status
    
    This function doesn't just initialise for compression, it actually
    compresses.  This patch sanity checks section size before allocating
    buffers for the uncompressed contents.
    
            * compress.c (bfd_init_section_compress_status): Sanity check
            section size.

Diff:
---
 bfd/compress.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/bfd/compress.c b/bfd/compress.c
index 39f9c50a445..844328b27a9 100644
--- a/bfd/compress.c
+++ b/bfd/compress.c
@@ -1065,7 +1065,8 @@ bfd_init_section_compress_status (bfd *abfd, sec_ptr sec)
       || sec->size == 0
       || sec->rawsize != 0
       || sec->contents != NULL
-      || sec->compress_status != COMPRESS_SECTION_NONE)
+      || sec->compress_status != COMPRESS_SECTION_NONE
+      || _bfd_section_size_insane (abfd, sec))
     {
       bfd_set_error (bfd_error_invalid_operation);
       return false;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-03-29  2:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-29  2:50 [binutils-gdb] Sanity check section size in bfd_init_section_compress_status Alan Modra

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).