Bug 26412 - UBSAN error: objcopy.c:3026:12:
Summary: UBSAN error: objcopy.c:3026:12:
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: binutils (show other bugs)
Version: 2.34
: P2 normal
Target Milestone: 2.36
Assignee: Alan Modra
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-08-20 11:57 UTC by Martin Liska
Modified: 2020-08-26 14:36 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Last reconfirmed: 2020-08-26 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Liska 2020-08-20 11:57:46 UTC
The following fails when I build binutils with:
configure --build=x86_64-linux --disable-nls --disable-gdb --disable-gdbserver --disable-sim --disable-readline --disable-libdecnumber --enable-obsolete --target=aarch64-elf CFLAGS="-g -O2 -fsanitize=address,undefined -Wno-error" CXXLAGS="-g -O2 -fsanitize=address,undefined -Wno-error" LDFLAGS="-ldl"
Target: aarch64-elf
PASS: strings: decoding little-endian multibyte strings
Executing on host: /dev/shm/ie14cir6/binutils/objcopy  --dump-section .text=tmpdir/empty tmpdir/update-1.o   (timeout = 300)
/home/mliska/Programming/binutils/binutils/objcopy.c:3026:12: runtime error: null pointer passed as argument 1, which is declared to never be null
Comment 1 Sourceware Commits 2020-08-26 13:54:16 UTC
The master branch has been updated by Alan Modra <amodra@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=a68aba2da76e802faf2ea887a9d8ff16d3d5959f

commit a68aba2da76e802faf2ea887a9d8ff16d3d5959f
Author: Alan Modra <amodra@gmail.com>
Date:   Wed Aug 26 10:11:38 2020 +0930

    PR26412 UBSAN: objcopy.c:3026 null pointer fwrite
    
            PR 26412
            * objcopy.c (copy_object): Don't fwrite NULL contents.
Comment 2 Alan Modra 2020-08-26 14:36:41 UTC
Fixed