Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

clang-format --dry-run segfault on a binary file #44411

Open Quuxplusone opened 4 years ago

Quuxplusone commented 4 years ago
Bugzilla Link PR45441
Status NEW
Importance P normal
Reported by Sylvestre Ledru (sylvestre@debian.org)
Reported on 2020-04-06 01:17:24 -0700
Last modified on 2020-04-06 01:17:24 -0700
Version 10.0
Hardware PC Linux
CC djasper@google.com, klimek@google.com, llvm-bugs@lists.llvm.org
Fixed by commit(s)
Attachments a.i (1161 bytes, application/octet-stream)
Blocks
Blocked by
See also
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
Quuxplusone commented 4 years ago

Attached a.i (1161 bytes, application/octet-stream): binary file as example