This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Fix buffer overrun found by Coverity
- From: Tom Tromey <tom at tromey dot com>
- To: Gary Benson <gbenson at redhat dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Fri, 05 Oct 2018 08:18:38 -0600
- Subject: Re: [PATCH] Fix buffer overrun found by Coverity
- References: <1538747591-32283-1-git-send-email-gbenson@redhat.com>
>>>>> "Gary" == Gary Benson <gbenson@redhat.com> writes:
Gary> I would have committed this as obvious, but the testsuite doesn't
Gary> exercise this piece of code; I can't realistically say I've regression
Gary> tested this change, so I'd like another pair of eyes on it to be sure.
What about the fission-dwp.exp board maybe?
Or one of the other boards.
Gary> - memset (ids, 255, (DW_SECT_MAX + 1) * sizeof (int32_t));
Gary> - memset (ids_seen, 255, (DW_SECT_MAX + 1) * sizeof (int32_t));
Gary> + memset (ids, 255, sizeof_ids);
Gary> + memset (ids_seen, 255, sizeof (ids_seen));
Later the code does this:
if (id < DW_SECT_MIN || id > DW_SECT_MAX)
{
error (_("Dwarf Error: bad DWP hash table, bad section id %d"
[...]
ids_seen[id] = i;
ids[i] = id;
So I think it would be good to ensure that MAX_NR_V2_DWO_SECTIONS is
>= DW_SECT_MAX + 1. At least if I'm understanding this properly.
Tom