From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8527 invoked by alias); 25 Jul 2007 23:34:45 -0000 Received: (qmail 8519 invoked by uid 22791); 25 Jul 2007 23:34:44 -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 23:34:42 +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 l6PNYeWx029338 for ; Wed, 25 Jul 2007 16:34:40 -0700 Received: from 12.7.175.2 (SquirrelMail authenticated user msnyder) by webmail.sonic.net with HTTP; Wed, 25 Jul 2007 16:34:40 -0700 (PDT) Message-ID: <9013.12.7.175.2.1185406480.squirrel@webmail.sonic.net> Date: Wed, 25 Jul 2007 23:45:00 -0000 Subject: [patch] coffgen.c, degenerate case From: msnyder@sonic.net To: binutils@sourceware.org User-Agent: SquirrelMail/1.4.9a MIME-Version: 1.0 Content-Type: multipart/mixed;boundary="----=_20070725163440_51749" 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/msg00425.txt.bz2 ------=_20070725163440_51749 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit Content-length: 127 If size == 0 and bfd_malloc returns NULL, just return. No actual work to do anyway, and avoids passing null ptr to bfd_bread. ------=_20070725163440_51749 Content-Type: text/plain; name="coffgen1.txt" Content-Transfer-Encoding: 8bit Content-Disposition: attachment; filename="coffgen1.txt" Content-length: 1088 2007-07-25 Michael Snyder * coffgen.c (_bfd_coff_get_external_symbols): Nothing to be done if size == 0; return and avoid possible null pointer issues. Index: coffgen.c =================================================================== RCS file: /cvs/src/src/bfd/coffgen.c,v retrieving revision 1.59 diff -p -r1.59 coffgen.c *** coffgen.c 12 Jul 2007 07:16:40 -0000 1.59 --- coffgen.c 25 Jul 2007 23:30:25 -0000 *************** _bfd_coff_get_external_symbols (bfd *abf *** 1446,1453 **** size = obj_raw_syment_count (abfd) * symesz; syms = bfd_malloc (size); ! if (syms == NULL && size != 0) ! return FALSE; if (bfd_seek (abfd, obj_sym_filepos (abfd), SEEK_SET) != 0 || bfd_bread (syms, size, abfd) != size) --- 1446,1456 ---- size = obj_raw_syment_count (abfd) * symesz; syms = bfd_malloc (size); ! if (syms == NULL) ! if (size == 0) ! return TRUE; ! else ! return FALSE; if (bfd_seek (abfd, obj_sym_filepos (abfd), SEEK_SET) != 0 || bfd_bread (syms, size, abfd) != size) ------=_20070725163440_51749--