Skip to content

A NULL pointer dereference in the function if_condition() modules/preprocs/nasm/nasm-pp.c:2134 #168

Open
@Clingto

Description

System info:
Ubuntu 16.04.6 LTS, X64, gcc 5.4.0, yasm (latest master 009450c)
Compile Command:

$ ./autogen.sh
make distclean

CC=gcc CXX=g++ CFLAGS="-fsanitize=address -fno-omit-frame-pointer -g" CXXFLAGS="-fsanitize=address -fno-omit-frame-pointer -g" ./configure --prefix=$PWD/build --disable-shared
make -j
make install

Run Command:

$ yasm  $POC

POC file:
https://github.com/Clingto/POC/blob/master/MSA/yasm/yasm-2134-if_condition-null-pointer-deref

ASAN info:

ASAN:SIGSEGV
=================================================================
==13685==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7f1a02e5e870 bp 0x7fffcb38b530 sp 0x7fffcb38b380 T0)
    #0 0x7f1a02e5e86f in if_condition  test/yasm-uaf/SRC_asan/modules/preprocs/nasm/nasm-pp.c:2134
    #1 0x7f1a02eb88c7 in do_directive  test/yasm-uaf/SRC_asan/modules/preprocs/nasm/nasm-pp.c:2907
    #2 0x7f1a02ec0333 in pp_getline  test/yasm-uaf/SRC_asan/modules/preprocs/nasm/nasm-pp.c:5083
    #3 0x7f1a02ea9d46 in nasm_preproc_get_line  test/yasm-uaf/SRC_asan/modules/preprocs/nasm/nasm-preproc.c:198
    #4 0x7f1a02e9b2ac in nasm_parser_parse  test/yasm-uaf/SRC_asan/modules/parsers/nasm/nasm-parse.c:218
    #5 0x7f1a02e8f36b in nasm_do_parse  test/yasm-uaf/SRC_asan/modules/parsers/nasm/nasm-parser.c:66
    #6 0x7f1a02e8f36b in nasm_parser_do_parse  test/yasm-uaf/SRC_asan/modules/parsers/nasm/nasm-parser.c:83
    #7 0x402c84 in do_assemble  test/yasm-uaf/SRC_asan/frontends/yasm/yasm.c:521
    #8 0x402c84 in main  test/yasm-uaf/SRC_asan/frontends/yasm/yasm.c:753
    #9 0x7f1a0603682f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
    #10 0x403ee8 in _start ( test/yasm-uaf/bin_asan/bin/yasm+0x403ee8)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV  test/yasm-uaf/SRC_asan/modules/preprocs/nasm/nasm-pp.c:2134 if_condition
==13685==ABORTING

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions