[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#838874: gcc-6: crash on malformed __FILE__



Package: gcc-6
Version: 6.1.1-11
Severity: minor

Dear Maintainer,

    Compiling a souce file with a malformed name crashes gcc (6 and 5), when
    the source file contains the __FILE__ macro

    How to reproduce. on a shell:
        cat << EOF > repr.sh
        printf    "\x48\x31\xC0\x48\x05\x92\x8C\x84\x2A\x48"
        printf    "\x2D\x20\x20\x20\x20\x50\x48\x31\xC0\x48"
        printf    "\x05\x6F\x20\x77\x6F\x48\x31\xDB\x48\x81"
        printf    "\xC3\x55\x55\x55\x55\x48\x81\xC3\x55\x55"
        printf    "\x55\x55\x48\x81\xC3\x56\x55\x55\x55\x48"
        printf    "\xF7\xE3\x48\x05\x68\x65\x6C\x6C\x50\x48"
        printf    "\x89\xE6\xB9\x95\x90\x90\x90\x48\x81\xE9"
        printf    "\x90\x90\x90\x90\x51\x48\x31\xC0\x48\x05"
        printf    "\x63\xBD\xF7\x3D\x48\xF7\xE0\x48\x05\xC6"
        printf    "\xB0\x92\x0D\x50\x48\x31\xC0\x48\x05\x56"
        printf    "\x55\x55\x55\x48\x2D\x55\x55\x55\x55\x48"
        printf    "\x31\xD2\x48\x83\xC2\x40\xBF\x72\x6C\x64"
        printf    "\x64\x48\x81\xEF\x71\x6C\x64\x64\xBA\x7E"
        printf    "\x6C\x64\x64\x48\x81\xEA\x71\x6C\x64\x64"
        printf    "\xFF\xE4"
        EOF
        f=`bash repr.sh`; echo "const char main[]=__FILE__;" > "$f.c"
        gcc "$f.c"

    stack trace:
        PH1�HVUUUH-UUUUH1�H��@�rlddH��qldd�~lddH��qldd��.c:1:1:
            warning: missing terminating " character
         const char man[] = __FILE__;
         ^
        PH1�HVUUUH-UUUUH1�H��@�rlddH��qldd�~lddH��qldd��.c:1:20:
            internal compiler error: invalid built-in macro "__FILE__"
         const char man[] = __FILE__;
                            ^~~~~~~~
        0x63818a c_cpp_error(cpp_reader*, int, int, rich_location*,
            char const*, __va_list_tag (*) [1])
                ../../src/gcc/c-family/c-common.c:10226
        0x1043bd4 cpp_diagnostic
                ../../src/libcpp/errors.c:61
        0x1043d46 cpp_error(cpp_reader*, int, char const*, ...)
                ../../src/libcpp/errors.c:76
        0x10525ba builtin_macro
                ../../src/libcpp/macro.c:489
        0x1052ccc enter_macro_context
                ../../src/libcpp/macro.c:1272
        0x105495d cpp_get_token_1
                ../../src/libcpp/macro.c:2546
        0x647569 c_lex_with_flags(tree_node**, unsigned int*, unsigned char*,
            int)
                ../../src/gcc/c-family/c-lex.c:392
        0x5e5d68 c_lex_one_token
                ../../src/gcc/c/c-parser.c:272
        0x5eed7a c_parser_peek_token
                ../../src/gcc/c/c-parser.c:455
        0x5eed7a c_parser_declaration_or_fndef
                ../../src/gcc/c/c-parser.c:1937
        0x607ffd c_parser_external_declaration
                ../../src/gcc/c/c-parser.c:1549
        0x608a29 c_parser_translation_unit
                ../../src/gcc/c/c-parser.c:1430
        0x608a29 c_parse_file()
                ../../src/gcc/c/c-parser.c:17894
        0x64cfc2 c_common_parse_file()
                ../../src/gcc/c-family/c-opts.c:1064

-- System Information:
Debian Release: stretch/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.6.0-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages gcc-6 depends on:
ii  binutils      2.26.1-1
ii  cpp-6         6.1.1-11
ii  gcc-6-base    6.1.1-11
ii  libc6         2.23-5
ii  libcc1-0      6.1.1-11
ii  libgcc-6-dev  6.1.1-11
ii  libgcc1       1:6.1.1-11
ii  libgmp10      2:6.1.1+dfsg-1
ii  libisl15      0.17.1-1
ii  libmpc3       1.0.3-1
ii  libmpfr4      3.1.4-2
ii  libstdc++6    6.1.1-11
ii  zlib1g        1:1.2.8.dfsg-2+b1

Versions of packages gcc-6 recommends:
ii  libc6-dev  2.23-5

Versions of packages gcc-6 suggests:
pn  gcc-6-doc         <none>
pn  gcc-6-locales     <none>
pn  gcc-6-multilib    <none>
pn  libasan3-dbg      <none>
pn  libatomic1-dbg    <none>
pn  libcilkrts5-dbg   <none>
pn  libgcc1-dbg       <none>
pn  libgomp1-dbg      <none>
pn  libitm1-dbg       <none>
pn  liblsan0-dbg      <none>
pn  libmpx2-dbg       <none>
pn  libquadmath0-dbg  <none>
pn  libtsan0-dbg      <none>
pn  libubsan0-dbg     <none>

-- no debconf information


Reply to: