This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix buffer overrun found by Coverity


>>>>> "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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]