[LLVMbugs] [Bug 22282] New: Can easily crash libclang by passing non-existing file

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Jan 21 08:30:30 PST 2015


http://llvm.org/bugs/show_bug.cgi?id=22282

            Bug ID: 22282
           Summary: Can easily crash libclang by passing non-existing file
           Product: clang
           Version: 3.5
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: libclang
          Assignee: unassignedclangbugs at nondot.org
          Reporter: kfunk at kde.org
                CC: klimek at google.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Steps to reproduce:

$ ~/devel/build/llvm/bin/c-index-test -test-print-type idonotexist
libclang: crash detected during parsing: {
  'source_filename' : '(null)'
  'command_line_args' : ['idonotexist'],
  'unsaved_files' : [],
  'options' : 1,
}
Unable to load translation unit!
Failure: libclang crashed

This should be handled more gracefully I think.

Behavior introduced by: Introduced by:
http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20140210/098976.html

Backtrace:
#0  0x00007ffff6504a74 in
llvm::SmallVectorTemplateCommon<clang::StoredDiagnostic, void>::begin
(this=0x248) at /home/krf/devel/src/llvm/include/llvm/ADT/SmallVector.h:111
#1  0x00007ffff64e4ad2 in clang::ASTUnit::stored_diag_begin (this=0x0) at
/home/krf/devel/src/llvm/tools/clang/include/clang/Frontend/ASTUnit.h:644
#2  0x00007ffff64e55c5 in clang::cxtu::isASTReadError (AU=0x0) at
/home/krf/devel/src/llvm/tools/clang/tools/libclang/CIndex.cpp:88
#3  0x00007ffff64f0d6e in clang_parseTranslationUnit_Impl
(UserData=0x7ffff49f9d30) at
/home/krf/devel/src/llvm/tools/clang/tools/libclang/CIndex.cpp:2976
#4  0x00007ffff64e536a in llvm::CrashRecoveryContext::RunSafelyOnThread(void
(*)(void*), void*, unsigned int)::{lambda()#1}::operator()() const
(__closure=0x7ffff49f9c60) at
/home/krf/devel/src/llvm/include/llvm/Support/CrashRecoveryContext.h:96
#5  0x00007ffff65114b2 in llvm::function_ref<void
()>::callback_fn<llvm::CrashRecoveryContext::RunSafelyOnThread(void (*)(void*),
void*, unsigned int)::{lambda()#1}>(long) (callable=140737297488992) at
/home/krf/devel/src/llvm/include/llvm/ADT/STLExtras.h:101
#6  0x00007ffff70dff5c in llvm::function_ref<void ()>::operator()() const
(this=0x7fffefffee30) at
/home/krf/devel/src/llvm/include/llvm/ADT/STLExtras.h:112
#7  0x00007ffff70dfc37 in
llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>)
(this=0x7ffff49f9d20, Fn=...) at
/home/krf/devel/src/llvm/lib/Support/CrashRecoveryContext.cpp:318
#8  0x00007ffff70dfce6 in RunSafelyOnThread_Dispatch (UserData=0x7ffff49f9c00)
at /home/krf/devel/src/llvm/lib/Support/CrashRecoveryContext.cpp:366
#9  0x00007ffff712bd0c in ExecuteOnThread_Dispatch (Arg=0x7ffff49f9b70) at
/home/krf/devel/src/llvm/lib/Support/Threading.cpp:40
#10 0x00007ffff566a0a5 in start_thread (arg=0x7fffeffff700) at
pthread_create.c:309
#11 0x00007ffff5da788d in clone () at
../sysdeps/unix/sysv/linux/x86_64/clone.S:111

-- 
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/20150121/c68e7c9a/attachment.html>


More information about the llvm-bugs mailing list