Fix an illegal memory access when parsing a corrupt assembler file.
PR 27355 * dwarf2dbg.c (allocate_filename_to_slot): Allocate the dirs array if it has not already been created.
This commit is contained in:
parent
4001d90dde
commit
80b652efa2
@ -1,3 +1,9 @@
|
|||||||
|
2021-02-08 Nick Clifton <nickc@redhat.com>
|
||||||
|
|
||||||
|
PR 27355
|
||||||
|
* dwarf2dbg.c (allocate_filename_to_slot): Allocate the dirs array
|
||||||
|
if it has not already been created.
|
||||||
|
|
||||||
2021-02-04 Nelson Chu <nelson.chu@sifive.com>
|
2021-02-04 Nelson Chu <nelson.chu@sifive.com>
|
||||||
|
|
||||||
* config/tc-riscv.c (riscv_multi_subset_supports): Removed
|
* config/tc-riscv.c (riscv_multi_subset_supports): Removed
|
||||||
|
@ -769,7 +769,7 @@ allocate_filename_to_slot (const char * dirname,
|
|||||||
{
|
{
|
||||||
const char * dir = NULL;
|
const char * dir = NULL;
|
||||||
|
|
||||||
if (dirs)
|
if (dirs != NULL)
|
||||||
dir = dirs[files[num].dir];
|
dir = dirs[files[num].dir];
|
||||||
|
|
||||||
if (with_md5
|
if (with_md5
|
||||||
@ -787,7 +787,15 @@ allocate_filename_to_slot (const char * dirname,
|
|||||||
/* If the filenames match, but the directory table entry was
|
/* If the filenames match, but the directory table entry was
|
||||||
empty, then fill it with the provided directory name. */
|
empty, then fill it with the provided directory name. */
|
||||||
if (dir == NULL)
|
if (dir == NULL)
|
||||||
dirs[files[num].dir] = xmemdup0 (dirname, strlen (dirname));
|
{
|
||||||
|
if (dirs == NULL)
|
||||||
|
{
|
||||||
|
dirs_allocated = files[num].dir + 32;
|
||||||
|
dirs = XCNEWVEC (char *, dirs_allocated);
|
||||||
|
}
|
||||||
|
|
||||||
|
dirs[files[num].dir] = xmemdup0 (dirname, strlen (dirname));
|
||||||
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user