[Lldb-commits] [PATCH] D68773: [lldb] Fix out of bounds read in DataExtractor::GetCStr and add actually unit test that function.
Raphael Isemann via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Thu Oct 10 03:10:25 PDT 2019
teemperor created this revision.
teemperor added a reviewer: labath.
Herald added subscribers: lldb-commits, JDevlieghere, abidh.
Herald added a project: LLDB.
The `if (*cstr_end == '\0')` in the previous code checked if the previous loop terminated because it
found a null terminator or because it reached the end of the data. However, in the case that we hit
the end of the data before finding a null terminator, `cstr_end` points behind the last byte in our
data and `*cstr_end` reads the memory behind the array (which may be uninitialised)
This patch just rewrites that function use `std::find` and adds the relevant unit tests.
Repository:
rLLDB LLDB
https://reviews.llvm.org/D68773
Files:
lldb/source/Utility/DataExtractor.cpp
lldb/unittests/Utility/DataExtractorTest.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D68773.224295.patch
Type: text/x-patch
Size: 3764 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20191010/a8c51b7a/attachment.bin>
More information about the lldb-commits
mailing list