From 252e57fdd41118855f67ada7785b4ce3d5e61ad3 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Wed, 26 Aug 2020 20:20:11 +0930 Subject: [PATCH] PR26506 UBSAN: elf32-xtensa.c:3203 null pointer memcpy PR 26506 * elf32-xtensa.c (elf_xtensa_combine_prop_entries): Return early when section is empty. --- bfd/ChangeLog | 6 ++++++ bfd/elf32-xtensa.c | 3 +++ 2 files changed, 9 insertions(+) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 1cd7943abc3..765188d303c 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,9 @@ +2020-08-26 Alan Modra + + PR 26506 + * elf32-xtensa.c (elf_xtensa_combine_prop_entries): Return early + when section is empty. + 2020-08-26 Alan Modra PR 26498 diff --git a/bfd/elf32-xtensa.c b/bfd/elf32-xtensa.c index 65c6ceb3794..5184fbf1be7 100644 --- a/bfd/elf32-xtensa.c +++ b/bfd/elf32-xtensa.c @@ -3117,6 +3117,9 @@ elf_xtensa_combine_prop_entries (bfd *output_bfd, int n, m, num; section_size = sxtlit->size; + if (section_size == 0) + return 0; + BFD_ASSERT (section_size % 8 == 0); num = section_size / 8; -- 2.30.2