Bug 22187 - infinite loop in find_abstract_instance_name (dwarf2.c)
Summary: infinite loop in find_abstract_instance_name (dwarf2.c)
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: binutils (show other bugs)
Version: 2.30 (HEAD)
: P2 normal
Target Milestone: 2.30
Assignee: Alan Modra
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-09-22 10:03 UTC by Agostino Sarubbo
Modified: 2017-09-24 06:58 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Last reconfirmed: 2017-09-24 00:00:00


Attachments
stacktrace (1.56 KB, text/plain)
2017-09-22 10:03 UTC, Agostino Sarubbo
Details
testcase (10.53 KB, application/octet-stream)
2017-09-22 10:04 UTC, Agostino Sarubbo
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Agostino Sarubbo 2017-09-22 10:03:18 UTC
Created attachment 10461 [details]
stacktrace

On master compiled on 20170921.
# nm -V
GNU nm (Gentoo git) 2.29.51.20170921


Command to reproduce:
# nm -A -a -l -S -s --special-syms --synthetic --with-symbol-versions -D $FILE
Comment 1 Agostino Sarubbo 2017-09-22 10:04:19 UTC
Created attachment 10462 [details]
testcase
Comment 2 cvs-commit@gcc.gnu.org 2017-09-24 06:56:55 UTC
The master branch has been updated by Alan Modra <amodra@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=52a93b95ec0771c97e26f0bb28630a271a667bd2

commit 52a93b95ec0771c97e26f0bb28630a271a667bd2
Author: Alan Modra <amodra@gmail.com>
Date:   Sun Sep 24 14:37:16 2017 +0930

    PR22187, infinite loop in find_abstract_instance_name
    
    This patch prevents the simple case of infinite recursion in
    find_abstract_instance_name by ensuring that the attributes being
    processed are not the same as the previous call.
    
    The patch also does a little cleanup, and leaves in place some changes
    to the nested_funcs array that I made when I wrongly thought looping
    might occur in scan_unit_for_symbols.
    
    	PR 22187
    	* dwarf2.c (find_abstract_instance_name): Add orig_info_ptr and
    	pname param.  Return status.  Make name const.  Don't abort,
    	return an error.  Formatting.  Exit if current info_ptr matches
    	orig_info_ptr.  Update callers.
    	(scan_unit_for_symbols): Start at nesting_level of zero.  Make
    	nested_funcs an array of structs for extensibility.  Formatting.
Comment 3 Alan Modra 2017-09-24 06:58:41 UTC
Fixed