Created attachment 23313
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
a.i
(1161 bytes, application/octet-stream)