From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27642 invoked by alias); 4 Dec 2007 16:14:37 -0000 Received: (qmail 27631 invoked by uid 22791); 4 Dec 2007 16:14:36 -0000 X-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00,DK_POLICY_SIGNSOME,FORGED_RCVD_HELO X-Spam-Check-By: sourceware.org Received: from NaN.false.org (HELO nan.false.org) (208.75.86.248) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 04 Dec 2007 16:14:27 +0000 Received: from nan.false.org (localhost [127.0.0.1]) by nan.false.org (Postfix) with ESMTP id 1CB199833F for ; Tue, 4 Dec 2007 16:14:26 +0000 (GMT) Received: from caradoc.them.org (22.svnf5.xdsl.nauticom.net [209.195.183.55]) by nan.false.org (Postfix) with ESMTP id F29D598100 for ; Tue, 4 Dec 2007 16:14:25 +0000 (GMT) Received: from drow by caradoc.them.org with local (Exim 4.68) (envelope-from ) id 1IzaPh-00027S-9p for prelink@sourceware.org; Tue, 04 Dec 2007 11:14:25 -0500 Date: Tue, 04 Dec 2007 16:14:00 -0000 From: Daniel Jacobowitz To: prelink@sourceware.org Subject: Do not crash on corrupt symbol tables Message-ID: <20071204161425.GA8129@caradoc.them.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.15 (2007-04-09) X-IsSubscribed: yes Mailing-List: contact prelink-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: prelink-owner@sourceware.org X-SW-Source: 2007-q4/txt/msg00003.txt.bz2 I have a library with a very corrupt symbol table. It kills the prelinker, because some sections have not yet been moved in dso->scn when we go to close the corrupt file, so it tries to free some mmapped pointers. This patch lets everything else in the filesystem be prelinked normally. -- Daniel Jacobowitz CodeSourcery 2007-12-04 Daniel Jacobowitz * dso.c (reopen_dso): Update dso->scn and dso->shdr before adjusting sections. --- src/dso.c | 4 ++++ 1 files changed, 4 insertions(+) Index: prelink-20061211/src/dso.c =================================================================== --- prelink-20061211.orig/src/dso.c 2007-12-04 07:36:25.000000000 -0800 +++ prelink-20061211/src/dso.c 2007-12-04 08:05:40.000000000 -0800 @@ -936,6 +936,10 @@ reopen_dso (DSO *dso, struct section_mov { dso->scn[i] = elf_getscn (dso->elf, i); gelfx_getshdr (dso->elf, dso->scn[i], dso->shdr + i); + } + + for (i = 1; i < move->new_shnum; i++) + { if (move->new_to_old[i] == -1) continue; if (dso->move