[llvm-bugs] [Bug 45441] New: clang-format --dry-run segfault on a binary file

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Apr 6 01:17:24 PDT 2020


https://bugs.llvm.org/show_bug.cgi?id=45441

            Bug ID: 45441
           Summary: clang-format --dry-run segfault on a binary file
           Product: clang
           Version: 10.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Formatter
          Assignee: unassignedclangbugs at nondot.org
          Reporter: sylvestre at debian.org
                CC: djasper at google.com, klimek at google.com,
                    llvm-bugs at lists.llvm.org

Created attachment 23313
  --> https://bugs.llvm.org/attachment.cgi?id=23313&action=edit
binary file as example

Not a big deal as it should not be done but clang-format should not crash.


With the binary file as attachment, running clang-format crashes with:
$ clang-format-10 --dry-run a.i                                                 
Stack dump:
0.      Program arguments: clang-format-10 --dry-run a.i 
#0 0x00007f60d81956df llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/usr/lib/x86_64-linux-gnu/libLLVM-10.so.1+0xa626df)
#1 0x00007f60d8193990 llvm::sys::RunSignalHandlers()
(/usr/lib/x86_64-linux-gnu/libLLVM-10.so.1+0xa60990)
#2 0x00007f60d8195ca5 (/usr/lib/x86_64-linux-gnu/libLLVM-10.so.1+0xa62ca5)
#3 0x00007f60deaa6110 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x14110)
#4 0x00007f60d8135af5 llvm::SourceMgr::GetMessage(llvm::SMLoc,
llvm::SourceMgr::DiagKind, llvm::Twine const&, llvm::ArrayRef<llvm::SMRange>,
llvm::ArrayRef<llvm::SMFixIt>) const
(/usr/lib/x86_64-linux-gnu/libLLVM-10.so.1+0xa02af5)
#5 0x00000000004095fd (/usr/lib/llvm-10/bin/clang-format+0x4095fd)
#6 0x0000000000406ff4 (/usr/lib/llvm-10/bin/clang-format+0x406ff4)
#7 0x00007f60d7268e0b __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x26e0b)
#8 0x00000000004069ba (/usr/lib/llvm-10/bin/clang-format+0x4069ba)

removing --dry-run doesn't crash

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200406/97c0c517/attachment.html>


More information about the llvm-bugs mailing list