<html>
    <head>
      <base href="http://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 --- - Can easily crash libclang by passing non-existing file"
   href="http://llvm.org/bugs/show_bug.cgi?id=22282">22282</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Can easily crash libclang by passing non-existing file
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>3.5
          </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>libclang
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>kfunk@kde.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>klimek@google.com, llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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:
<a href="http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20140210/098976.html">http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20140210/098976.html</a>

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</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>