diff options
author | Alan Modra <amodra@gmail.com> | 2020-08-28 23:06:47 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2020-08-28 23:15:20 +0930 |
commit | 07319accdf8eecc5111b343802dadd067f683d26 (patch) | |
tree | 6e1d51aa8cb660b029e774d91dcc2806b9c41000 | |
parent | 4a5700b62f767ed08c97122bad182244700bb4e3 (diff) | |
download | gdb-07319accdf8eecc5111b343802dadd067f683d26.zip gdb-07319accdf8eecc5111b343802dadd067f683d26.tar.gz gdb-07319accdf8eecc5111b343802dadd067f683d26.tar.bz2 |
PR26418 UBSAN: cache.c:386 null pointer fwrite
And some more.
PR 26418
* ecofflink.c (bfd_ecoff_write_accumulated_debug): Don't write
zero size buffers.
-rw-r--r-- | bfd/ChangeLog | 6 | ||||
-rw-r--r-- | bfd/ecofflink.c | 4 |
2 files changed, 8 insertions, 2 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 805d156..33cc1c4 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,6 +1,12 @@ 2020-08-28 Alan Modra <amodra@gmail.com> PR 26418 + * ecofflink.c (bfd_ecoff_write_accumulated_debug): Don't write + zero size buffers. + +2020-08-28 Alan Modra <amodra@gmail.com> + + PR 26418 * ecofflink.c (WRITE): Really don't write zero size chunks. 2020-08-28 Tuckker <tuckkern+sourceware@gmail.com> diff --git a/bfd/ecofflink.c b/bfd/ecofflink.c index e8c3f9f..111ffdb 100644 --- a/bfd/ecofflink.c +++ b/bfd/ecofflink.c @@ -1652,7 +1652,7 @@ bfd_ecoff_write_accumulated_debug (void * handle, /* The external strings and symbol are not converted over to using shuffles. FIXME: They probably should be. */ amt = debug->symbolic_header.issExtMax; - if (bfd_bwrite (debug->ssext, amt, abfd) != amt) + if (amt != 0 && bfd_bwrite (debug->ssext, amt, abfd) != amt) goto error_return; if ((debug->symbolic_header.issExtMax & (swap->debug_align - 1)) != 0) { @@ -1682,7 +1682,7 @@ bfd_ecoff_write_accumulated_debug (void * handle, == (bfd_vma) bfd_tell (abfd))); amt = debug->symbolic_header.iextMax * swap->external_ext_size; - if (bfd_bwrite (debug->external_ext, amt, abfd) != amt) + if (amt != 0 && bfd_bwrite (debug->external_ext, amt, abfd) != amt) goto error_return; free (space); |