Hi Roland,
jankratochvil/readelf-twofiles it seems to be obvious.
Thanks, Jan
e1c1ceeab0af2ce94e37448fc6ee78275e39862e Mon Sep 17 00:00:00 2001 From: Jan Kratochvil jan.kratochvil@redhat.com Date: Sun, 27 Feb 2011 08:35:50 +0100 Subject: [PATCH] Invalid free() / delete / delete[] at 0x4C284F2: realloc (vg_replace_malloc.c:525) by 0x41CACB: xrealloc (xmalloc.c:77) by 0x40DB4A: notice_listptr (readelf.c:4382) by 0x411CF0: attr_callback (readelf.c:5544) by 0x4E438B8: dwarf_getattrs (dwarf_getattrs.c:124) by 0x412641: print_debug_units (readelf.c:5795) by 0x41287F: print_debug_info_section (readelf.c:5842) by 0x41651B: print_debug (readelf.c:7033) by 0x404910: process_elf_file (readelf.c:704) by 0x4041EE: process_dwflmod (readelf.c:532) by 0x4E52B17: dwfl_getmodules (dwfl_getmodules.c:103) by 0x404480: process_file (readelf.c:602) Address 0x60a0f10 is 0 bytes inside a block of size 1,024 free'd at 0x4C2756E: free (vg_replace_malloc.c:366) by 0x40DA9B: reset_listptr (readelf.c:4365) by 0x41656D: print_debug (readelf.c:7040) by 0x404910: process_elf_file (readelf.c:704) by 0x4041EE: process_dwflmod (readelf.c:532) by 0x4E52B17: dwfl_getmodules (dwfl_getmodules.c:103) by 0x404480: process_file (readelf.c:602) by 0x403774: main (readelf.c:277)
src/ 2011-02-27 Jan Kratochvil jan.kratochvil@redhat.com
* readelf.c (reset_listptr): Clear TABLE->TABLE.
tests/ 2011-02-27 Jan Kratochvil jan.kratochvil@redhat.com
* Makefile.am (TESTS): Add run-readelf-twofiles.sh. * run-readelf-twofiles.sh: New file. --- src/readelf.c | 1 + tests/Makefile.am | 2 +- tests/run-readelf-twofiles.sh | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 34 insertions(+), 1 deletions(-) create mode 100755 tests/run-readelf-twofiles.sh
diff --git a/src/readelf.c b/src/readelf.c index b798b5a..956d8bd 100644 --- a/src/readelf.c +++ b/src/readelf.c @@ -4363,6 +4363,7 @@ static void reset_listptr (struct listptr_table *table) { free (table->table); + table->table = NULL; table->n = table->alloc = 0; }
diff --git a/tests/Makefile.am b/tests/Makefile.am index 3c37cb3..d0e4246 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -76,7 +76,7 @@ TESTS = run-arextract.sh run-arsymtest.sh newfile test-nlist \ run-addrscopes.sh run-strings-test.sh run-funcscopes.sh \ run-find-prologues.sh run-allregs.sh \ run-readelf-test1.sh run-readelf-test2.sh run-readelf-test3.sh \ - run-readelf-test4.sh \ + run-readelf-test4.sh run-readelf-twofiles.sh \ run-native-test.sh run-bug1-test.sh \ dwfl-bug-addr-overflow run-addrname-test.sh \ dwfl-bug-fd-leak dwfl-bug-report \ diff --git a/tests/run-readelf-twofiles.sh b/tests/run-readelf-twofiles.sh new file mode 100755 index 0000000..4255587 --- /dev/null +++ b/tests/run-readelf-twofiles.sh @@ -0,0 +1,32 @@ +#! /bin/sh +# Copyright (C) 2011 Red Hat, Inc. +# This file is part of Red Hat elfutils. +# +# Red Hat elfutils is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by the +# Free Software Foundation; version 2 of the License. +# +# Red Hat elfutils is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with Red Hat elfutils; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +# +# Red Hat elfutils is an included package of the Open Invention Network. +# An included package of the Open Invention Network is a package for which +# Open Invention Network licensees cross-license their patents. No patent +# license is granted, either expressly or impliedly, by designation as an +# included package. Should you wish to participate in the Open Invention +# Network licensing program, please visit www.openinventionnetwork.com +# http://www.openinventionnetwork.com. + +. $srcdir/test-subr.sh + +testfiles testfile14 + +testrun >/dev/null ../src/readelf -w testfile14 testfile14 + +exit 0
elfutils-devel@lists.fedorahosted.org