This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] gdb/dwarf2read.c: Sanity check DW_AT_sibling values.
- From: Will Newton <will dot newton at linaro dot org>
- To: Tom Tromey <tromey at redhat dot com>
- Cc: "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>, Patch Tracking <patches at linaro dot org>
- Date: Tue, 5 Nov 2013 09:15:31 +0000
- Subject: Re: [PATCH] gdb/dwarf2read.c: Sanity check DW_AT_sibling values.
- Authentication-results: sourceware.org; auth=none
- References: <52741B5A dot 6090800 at linaro dot org> <8761s8w46p dot fsf at fleche dot redhat dot com>
On 4 November 2013 15:57, Tom Tromey <tromey@redhat.com> wrote:
>>>>>> "Will" == Will Newton <will.newton@linaro.org> writes:
>
> Will> When reading objects with corrupt debug information it is possible that
> Will> the sibling chain can form a loop, which leads to an infinite loop and
> Will> memory exhaustion.
>
> Will> Avoid this situation by disregarding and DW_AT_sibling values that point
> Will> to a lower address than the current entry.
>
> Thanks for doing this.
>
> Will> + const gdb_byte *sibling_ptr = buffer + dwarf2_get_ref_die_offset (&attr).sect_off;
>
> This line is too long, it should be split somewhere.
Thanks, I'll fix these.
> Will> + if (sibling_ptr < info_ptr)
> Will> + complaint (&symfile_complaints,
> Will> + _("DW_AT_sibling points backwards"));
>
> I wonder whether the check should be "<=".
I'm not sure. It looks to me that info_ptr at this point will point to
the next attribute/DIE which could be a valid sibling?
--
Will Newton
Toolchain Working Group, Linaro