<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - llvm-mc crashes with invalid output-asm-variant"
   href="https://llvm.org/bugs/show_bug.cgi?id=28488">28488</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>llvm-mc crashes with invalid output-asm-variant
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>3.8
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>MC
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>jvoss+bugs@altsci.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Giving an invalid value to output-asm-variant causes llvm-mc to crash
dereferencing a null pointer.

echo '0xb0 0x0b' | llvm-mc --disassemble -triple=x86_64 --output-asm-variant=2
#0 0x00007ff528254708 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/usr/bin/../lib64/libLLVMSupport.so.3.8+0xcd708)
#1 0x00007ff5282526f6 llvm::sys::RunSignalHandlers()
(/usr/bin/../lib64/libLLVMSupport.so.3.8+0xcb6f6)
#2 0x00007ff5282529cb (/usr/bin/../lib64/libLLVMSupport.so.3.8+0xcb9cb)
#3 0x00007ff5278f9160 (/lib64/libc.so.6+0x33160)
#4 0x000000000040987d _init (/usr/bin/llvm-mc+0x40987d)
#5 0x00007ff5278e6790 __libc_start_main (/lib64/libc.so.6+0x20790)
#6 0x000000000040a429 _init (/usr/bin/llvm-mc+0x40a429)
Stack dump:
0.      Program arguments: llvm-mc --disassemble -triple=x86_64
--output-asm-variant=2 
Segmentation fault

gdb llvm-mc

(gdb) run --disassemble -triple=x86_64 --output-asm-variant=2
0xb0 0x0b

Program received signal SIGSEGV, Segmentation fault.
0x000000000040987d in main ()
(gdb) bt
#0  0x000000000040987d in main ()
(gdb) disassemble
...
=> 0x000000000040987d <+7005>:  mov    %al,0x29(%rdx)

(gdb) i r
...
rdx            0x0      0</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>