From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32006 invoked by alias); 26 Jul 2007 02:20:17 -0000 Received: (qmail 31997 invoked by uid 22791); 26 Jul 2007 02:20:17 -0000 X-Spam-Check-By: sourceware.org Received: from alnrmhc16.comcast.net (HELO alnrmhc16.comcast.net) (206.18.177.56) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 26 Jul 2007 02:20:15 +0000 Received: from lucon.org ([24.6.230.138]) by comcast.net (alnrmhc16) with ESMTP id <20070726022013b1600pl34je>; Thu, 26 Jul 2007 02:20:13 +0000 Received: by lucon.org (Postfix, from userid 500) id 35E1EF8259; Wed, 25 Jul 2007 19:20:13 -0700 (PDT) Date: Thu, 26 Jul 2007 06:18:00 -0000 From: "H.J. Lu" To: msnyder@sonic.net Cc: binutils@sourceware.org Subject: Re: [patch] elf32-i386.c, check for null Message-ID: <20070726022013.GB29523@lucon.org> References: <22765.12.7.175.2.1185413008.squirrel@webmail.sonic.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <22765.12.7.175.2.1185413008.squirrel@webmail.sonic.net> User-Agent: Mutt/1.5.14 (2007-02-12) 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/msg00439.txt.bz2 On Wed, Jul 25, 2007 at 06:23:28PM -0700, msnyder@sonic.net wrote: > The function checks for h == NULL elsewhere, I assume it needs to > be checked here too (since the call will dereference it). > > 2007-07-25 Michael Snyder > > * elf32-i386.c (elf_i386_check_relocs): Check for null pointer. > > Index: elf32-i386.c > =================================================================== > RCS file: /cvs/src/src/bfd/elf32-i386.c,v > retrieving revision 1.174 > diff -p -r1.174 elf32-i386.c > *** elf32-i386.c 3 Jul 2007 14:26:41 -0000 1.174 > --- elf32-i386.c 26 Jul 2007 01:20:28 -0000 > *************** elf_i386_check_relocs (bfd *abfd, > *** 1277,1284 **** > /* This relocation describes which C++ vtable entries are actually > used. Record for later use during GC. */ > case R_386_GNU_VTENTRY: > ! if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_offset)) > ! return FALSE; > break; > > default: > --- 1277,1285 ---- > /* This relocation describes which C++ vtable entries are actually > used. Record for later use during GC. */ > case R_386_GNU_VTENTRY: > ! if (h != NULL) > ! if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_offset)) > ! return FALSE; > break; > > default: I prefer BFD_ASSERT (h != NULL) and R_386_GNU_VTINHERIT has the same issue. H.J.