From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11000 invoked by alias); 25 Jul 2007 19:07:07 -0000 Received: (qmail 10834 invoked by uid 22791); 25 Jul 2007 19:07:06 -0000 X-Spam-Check-By: sourceware.org Received: from a.mail.sonic.net (HELO a.mail.sonic.net) (64.142.16.245) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 25 Jul 2007 19:07:04 +0000 Received: from webmail.sonic.net (b.webmail.sonic.net [64.142.100.148]) by a.mail.sonic.net (8.13.8.Beta0-Sonic/8.13.7) with ESMTP id l6PJ6xaY001305 for ; Wed, 25 Jul 2007 12:06:59 -0700 Received: from 12.7.175.2 (SquirrelMail authenticated user msnyder) by webmail.sonic.net with HTTP; Wed, 25 Jul 2007 12:06:59 -0700 (PDT) Message-ID: <14938.12.7.175.2.1185390419.squirrel@webmail.sonic.net> Date: Wed, 25 Jul 2007 20:10:00 -0000 Subject: [PATCH] aout relocs From: msnyder@sonic.net To: binutils@sourceware.org User-Agent: SquirrelMail/1.4.9a MIME-Version: 1.0 Content-Type: multipart/mixed;boundary="----=_20070725120659_77004" Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org X-SW-Source: 2007-07/txt/msg00411.txt.bz2 ------=_20070725120659_77004 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit Content-length: 400 Check me on this one, I'm a little uncertain. As near as I can tell, if reloc_size is zero, the routine does nothing useful. Maybe it will never be zero, but if it is, a few iffy things will happen: * we'll call malloc with a size of zero, which is ill defined, and later free the result * we'll call bfd_bread with a size of zero, and * a potentially null pointer may slip thru the cracks. ------=_20070725120659_77004 Content-Type: text/plain; name="reloc.txt" Content-Transfer-Encoding: 8bit Content-Disposition: attachment; filename="reloc.txt" Content-length: 1272 2007-07-25 Michael Snyder * aoutx.h (NAME): Return TRUE if reloc_size is zero. Index: aoutx.h =================================================================== RCS file: /cvs/src/src/bfd/aoutx.h,v retrieving revision 1.66 diff -p -r1.66 aoutx.h *** aoutx.h 3 Jul 2007 14:26:39 -0000 1.66 --- aoutx.h 25 Jul 2007 18:59:09 -0000 *************** NAME (aout, slurp_reloc_table) (bfd *abf *** 2280,2285 **** --- 2280,2288 ---- return FALSE; } + if (reloc_size == 0) + return TRUE; /* Nothing to be done. */ + if (bfd_seek (abfd, asect->rel_filepos, SEEK_SET) != 0) return FALSE; *************** NAME (aout, slurp_reloc_table) (bfd *abf *** 2289,2299 **** amt = count * sizeof (arelent); reloc_cache = bfd_zmalloc (amt); ! if (reloc_cache == NULL && count != 0) return FALSE; relocs = bfd_malloc (reloc_size); ! if (relocs == NULL && reloc_size != 0) { free (reloc_cache); return FALSE; --- 2292,2302 ---- amt = count * sizeof (arelent); reloc_cache = bfd_zmalloc (amt); ! if (reloc_cache == NULL) return FALSE; relocs = bfd_malloc (reloc_size); ! if (relocs == NULL) { free (reloc_cache); return FALSE; ------=_20070725120659_77004--