This is the mail archive of the
gdb-prs@sources.redhat.com
mailing list for the GDB project.
gdb/1479: elf_symtab_read sectinfo array size max_index
- From: tommoo at telco4u dot net
- To: gdb-gnats at sources dot redhat dot com
- Date: 9 Dec 2003 15:45:49 -0000
- Subject: gdb/1479: elf_symtab_read sectinfo array size max_index
- Reply-to: tommoo at telco4u dot net
>Number: 1479
>Category: gdb
>Synopsis: elf_symtab_read sectinfo array size max_index
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Tue Dec 09 15:48:01 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator: Tom Lucas
>Release: gdb-6.0
>Organization:
>Environment:
Solaris 2.6 sun4u sparc SUNW,Ultra-5_10
>Description:
File: gdb/elfread.c
Function: elf_symtab_read
Context: Lines 397-406?
max_index
= max (SECT_OFF_BSS (objfile),
max (SECT_OFF_DATA (objfile),
SECT_OFF_RODATA (objfile)));
size = (sizeof (struct stab_section_info)
+ (sizeof (CORE_ADDR)
* (max_index-1) ));
sectinfo = (struct stab_section_info *)
xmmalloc (objfile->md, size);
Problem:
The size of the sections array is 1 too small because
(max_index-1) (+ 1 for the entry included in the
stab_section_info struct) gives max_index entries.
Therefore max_index is one more than the last index.
This was causing gdb to SEGV for me until I changed it.
I've never done GNU dev before so I don't know what I'm
doing. So if someone wants to check this out then that'd
be grand. I did check for existing bug reports but nothing
came up under sectinfo etc.
>How-To-Repeat:
No idea, it was doing something with a "Bbss.bss" section at
the time while loading an exeecutable file.
>Fix:
Change (max_index-1) to max_index in calculation of size.
>Release-Note:
>Audit-Trail:
>Unformatted: