[PATCH] D42043: c-index: CXString: fix MSAN read-past-end bug
Steve O'Brien via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sun Jan 14 13:06:42 PST 2018
elsteveogrande created this revision.
Herald added a subscriber: cfe-commits.
Previous impl would read the byte past the end of a string (a `llvm::StringRef`), possibly exceeding the allocation for that memory and raising an MSAN issue.
This will instead save the character range specified by the `StringRef` and copy it on-demand to a new C string.
Passes existing tests, and now passes with MSAN as well.
Repository:
rC Clang
https://reviews.llvm.org/D42043
Files:
include/clang-c/CXString.h
tools/c-index-test/c-index-test.c
tools/libclang/CXString.cpp
tools/libclang/CXString.h
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42043.129791.patch
Type: text/x-patch
Size: 14317 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180114/4f591211/attachment.bin>
More information about the cfe-commits
mailing list