[LLVMdev] Clang

Valery Pushkar pollnossa at gmail.com
Wed Jul 29 07:54:19 PDT 2015


Hello everyone!

I've found strange code in tools/libclang/CIndex.cpp in function
clang_tokenize(). Lines

5570*Tokens = (CXToken *)malloc(sizeof(CXToken) * CXTokens.size());
  memmove(*Tokens, CXTokens.data(), sizeof(CXToken) * CXTokens.size());

seem weird without checking the result of malloc-function invocation. Since
malloc() can return null pointer, this value can be used in memmove below.

The same case I've found in
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150729/cc23788b/attachment.html>


More information about the llvm-dev mailing list