Bug 26441 - ASAN error: in get_b_cc gas/config/tc-cr16.c:1533
Summary: ASAN error: in get_b_cc gas/config/tc-cr16.c:1533
Alias: None
Product: binutils
Classification: Unclassified
Component: binutils (show other bugs)
Version: 2.34
: P2 normal
Target Milestone: 2.36
Assignee: Alan Modra
: 26439 26440 (view as bug list)
Depends on:
Reported: 2020-08-20 12:20 UTC by Martin Liska
Modified: 2020-08-30 05:17 UTC (History)
0 users

See Also:
Last reconfirmed: 2020-08-25 00:00:00


Note You need to log in before you can comment on or make changes to this bug.
Description Martin Liska 2020-08-20 12:20:34 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=cr16-elf CFLAGS="-g -O2 -fsanitize=address,undefined -Wno-error" CXXLAGS="-g -O2 -fsanitize=address,undefined -Wno-error" LDFLAGS="-ldl"
Target: cr16-elf
PASS: gas/macros/paren
Executing on host: sh -c {../as-new   /home/mliska/Programming/binutils/gas/testsuite/gas/macros/exit.s 2>gas.stderr}  /dev/null  (timeout = 300)
==42113==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7fffffffbbe5 at pc 0x0000004ccea0 bp 0x7fffffffbb80 sp 0x7fffffffbb78
    #0 0x4cce9f in get_b_cc /home/mliska/Programming/binutils/gas/config/tc-cr16.c:1533
    #1 0x4dbe40 in is_bcc_insn /home/mliska/Programming/binutils/gas/config/tc-cr16.c:1548
    #2 0x4dbe40 in md_assemble /home/mliska/Programming/binutils/gas/config/tc-cr16.c:2548
    #3 0x488f87 in read_a_source_file /home/mliska/Programming/binutils/gas/read.c:1182
    #4 0x41444f in perform_an_assembly_pass /home/mliska/Programming/binutils/gas/as.c:1253
    #5 0x41444f in main /home/mliska/Programming/binutils/gas/as.c:1417
    #6 0x7ffff6adacc9 in __libc_start_main (/lib64/libc.so.6+0x26cc9)
    #7 0x4167f9 in _start (/dev/shm/y8krvqy2/gas/as-new+0x4167f9)
Comment 1 Sourceware Commits 2020-08-25 13:38:17 UTC
The master branch has been updated by Alan Modra <amodra@sourceware.org>:


commit d3e0baddb206bc7c5ad5beb0c4ac3db8a5feb889
Author: Alan Modra <amodra@gmail.com>
Date:   Tue Aug 25 15:34:10 2020 +0930

    PR26441, ASAN: get_b_cc tc-cr16.c:1521
            PR 26441
            * config/tc-cr16.c (get_b_cc): Return NULL early if op isn't
            two or three chars, and don't bother copying.
Comment 2 Alan Modra 2020-08-25 13:42:35 UTC
Comment 3 Alan Modra 2020-08-30 05:17:38 UTC
*** Bug 26439 has been marked as a duplicate of this bug. ***
Comment 4 Alan Modra 2020-08-30 05:17:45 UTC
*** Bug 26440 has been marked as a duplicate of this bug. ***