diff options
author | Alan Modra <amodra@gmail.com> | 2021-02-16 14:39:04 +1030 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2021-02-16 14:47:41 +1030 |
commit | 9a12b194b0e9d1bde34aca175a2a7dead2fae7a9 (patch) | |
tree | 60323e76b8522fe95222ceee0e037f1599397a9a | |
parent | 70433886683b67b5a28abe35eac7e9ab82a4a9e4 (diff) | |
download | gdb-9a12b194b0e9d1bde34aca175a2a7dead2fae7a9.zip gdb-9a12b194b0e9d1bde34aca175a2a7dead2fae7a9.tar.gz gdb-9a12b194b0e9d1bde34aca175a2a7dead2fae7a9.tar.bz2 |
PR27426, More bugs in dwarf2dbg.c
PR 27426
* dwarf2dbg.c (allocate_filename_to_slot): Allocate the dirs array
in another place.
-rw-r--r-- | gas/ChangeLog | 6 | ||||
-rw-r--r-- | gas/dwarf2dbg.c | 14 |
2 files changed, 17 insertions, 3 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog index f4c9d0a..c74e63c 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,5 +1,11 @@ 2021-02-16 Alan Modra <amodra@gmail.com> + PR 27426 + * dwarf2dbg.c (allocate_filename_to_slot): Allocate the dirs array + in another place. + +2021-02-16 Alan Modra <amodra@gmail.com> + * read.c (demand_copy_C_string): Really check for embedded zeros. 2021-02-15 Andreas Krebbel <krebbel@linux.ibm.com> diff --git a/gas/dwarf2dbg.c b/gas/dwarf2dbg.c index f0cdc23..85db0be 100644 --- a/gas/dwarf2dbg.c +++ b/gas/dwarf2dbg.c @@ -812,10 +812,18 @@ allocate_filename_to_slot (const char * dirname, file = get_basename (filename); if (filename_cmp (file, files[num].filename) == 0) { + /* The filenames match, but the directory table entry is empty. + Fill it with the provided directory name. */ if (file > filename) - /* The filenames match, but the directory table entry is empty. - Fill it with the provided directory name. */ - dirs[files[num].dir] = xmemdup0 (filename, file - filename); + { + if (dirs == NULL) + { + dirs_allocated = files[num].dir + 32; + dirs = XCNEWVEC (char *, dirs_allocated); + } + + dirs[files[num].dir] = xmemdup0 (filename, file - filename); + } return TRUE; } } |