From: Roland McGrath Date: Tue, 6 Apr 2010 07:04:49 +0000 (-0700) Subject: Fix auxv scanning in core-file grokking. X-Git-Tag: elfutils-0.146~22 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5ea349b66b627ee31be93826f1357f88a7a26aff;p=thirdparty%2Felfutils.git Fix auxv scanning in core-file grokking. --- diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog index 86cc69305..5205bdc9a 100644 --- a/libdwfl/ChangeLog +++ b/libdwfl/ChangeLog @@ -1,3 +1,8 @@ +2010-03-11 Roland McGrath + + * link_map.c (auxv_format_probe): Fix scanning loop, so we really scan + the second half for 32-bit matches. + 2010-03-10 Roland McGrath * core-file.c (dwfl_core_file_report): Punt EHDR argument. diff --git a/libdwfl/link_map.c b/libdwfl/link_map.c index ecb499058..5991a1128 100644 --- a/libdwfl/link_map.c +++ b/libdwfl/link_map.c @@ -1,5 +1,5 @@ /* Report modules by examining dynamic linker data structures. - Copyright (C) 2008, 2009 Red Hat, Inc. + Copyright (C) 2008-2010 Red Hat, Inc. This file is part of Red Hat elfutils. Red Hat elfutils is free software; you can redistribute it and/or modify @@ -123,8 +123,7 @@ auxv_format_probe (const void *auxv, size_t size, return false; } - size_t i; - for (i = 0; i < size / sizeof (Elf64_auxv_t); ++i) + for (size_t i = 0; i < size / sizeof (Elf64_auxv_t); ++i) { if (check64 (i)) { @@ -132,18 +131,12 @@ auxv_format_probe (const void *auxv, size_t size, return true; } - if (check32 (i)) + if (check32 (i * 2) || check32 (i * 2 + 1)) { *elfclass = ELFCLASS32; return true; } } - for (; i < size / sizeof (Elf64_auxv_t); ++i) - if (check32 (i)) - { - *elfclass = ELFCLASS32; - return true; - } return false; }