search for: cxtokens

Displaying 2 results from an estimated 2 matches for "cxtokens".

Did you mean: ctokens
2015 Jul 29
1
[LLVMdev] Clang: strange malloc usage
Hello everyone! I've found weird lines of code in tools/libclang/CIndex.cpp file in clang sources. Function clang_tokenize holds the following lines: *Tokens = (CXToken *)malloc(sizeof(CXToken) * CXTokens.size()); memmove(*Tokens, CXTokens.data(), sizeof(CXToken) * CXTokens.size()); Since malloc function can return null pointer and there are no checks for this case, memmove invocation leads to segmentation fault. The same case can be found in tools/libclang/CXString.cpp file in function createDu...
2015 Jul 29
0
[LLVMdev] Clang
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 --------...