From: Michael Snyder <msnyder@vmware.com>
To: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>,
binutils@sourceware.org, "H.J. Lu" <hjl.tools@gmail.com>
Subject: [RFA] bfd, compress.c (bfd_compress_section_contents): Check for out of mem.
Date: Sun, 06 Mar 2011 00:36:00 -0000 [thread overview]
Message-ID: <4D72D6F7.1060501@vmware.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 58 bytes --]
Fail gracefully if not enough memory for operation.
OK?
[-- Attachment #2: compress.txt --]
[-- Type: text/plain, Size: 801 bytes --]
2011-03-05 Michael Snyder <msnyder@vmware.com>
* compress.c (bfd_compress_section_contents): Check for out of mem.
Index: compress.c
===================================================================
RCS file: /cvs/src/src/bfd/compress.c,v
retrieving revision 1.7
diff -u -p -r1.7 compress.c
--- compress.c 24 Dec 2010 10:40:19 -0000 1.7
+++ compress.c 6 Mar 2011 00:32:01 -0000
@@ -100,6 +100,12 @@ bfd_compress_section_contents (bfd *abfd
compressed_size = compressBound (uncompressed_size) + 12;
compressed_buffer = (bfd_byte *) bfd_malloc (compressed_size);
+ if (compressed_buffer == NULL)
+ {
+ bfd_set_error (bfd_error_no_memory);
+ return FALSE;
+ }
+
if (compress ((Bytef*) compressed_buffer + 12,
&compressed_size,
(const Bytef*) uncompressed_buffer,
next reply other threads:[~2011-03-06 0:36 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-06 0:36 Michael Snyder [this message]
2011-03-06 7:45 ` Alan Modra
2011-03-06 18:37 ` Michael Snyder
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=4D72D6F7.1060501@vmware.com \
--to=msnyder@vmware.com \
--cc=binutils@sourceware.org \
--cc=gdb-patches@sourceware.org \
--cc=hjl.tools@gmail.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).