Fix illegal memory access when parsing corrupt DWARF information.
PR 23064 * dwarf.c (process_cu_tu_index): Test for a potential buffer overrun before copying signature pointer.
This commit is contained in:
parent
c48935d75f
commit
6aea08d9f3
2 changed files with 18 additions and 1 deletions
|
@ -9287,7 +9287,18 @@ process_cu_tu_index (struct dwarf_section *section, int do_display)
|
|||
}
|
||||
|
||||
if (!do_display)
|
||||
memcpy (&this_set[row - 1].signature, ph, sizeof (uint64_t));
|
||||
{
|
||||
size_t num_copy = sizeof (uint64_t);
|
||||
|
||||
/* PR 23064: Beware of buffer overflow. */
|
||||
if (ph + num_copy < limit)
|
||||
memcpy (&this_set[row - 1].signature, ph, num_copy);
|
||||
else
|
||||
{
|
||||
warn (_("Signature (%p) extends beyond end of space in section\n"), ph);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
prow = poffsets + (row - 1) * ncols * 4;
|
||||
/* PR 17531: file: b8ce60a8. */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue