llvm-project/lldb/source/Utility
Raphael Isemann 067bb1f546 [lldb] Fix out of bounds read in DataExtractor::GetCStr and add unit test that function.
Summary:
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.

Reviewers: labath

Reviewed By: labath

Subscribers: abidh, JDevlieghere, lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D68773

llvm-svn: 374311
2019-10-10 11:15:38 +00:00
..
ARM64_DWARF_Registers.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
ARM64_ehframe_Registers.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
ARM_DWARF_Registers.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
ARM_ehframe_Registers.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
ArchSpec.cpp [LLDB] Add tests for PECOFF arm architecture identification 2019-09-24 12:20:52 +00:00
Args.cpp [lldb][NFC] Remove ArgEntry::ref member 2019-09-13 11:26:48 +00:00
Baton.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
Broadcaster.cpp [Logging] Replace Log::Printf with LLDB_LOG macro (NFC) 2019-07-24 17:56:10 +00:00
CMakeLists.txt [JSON] Remove Utility/JSON.{h|cpp} 2019-10-02 18:02:36 +00:00
CompletionRequest.cpp [lldb][NFC] Use AppendEmptyArgument in CompletionRequest constructor 2019-09-26 07:06:05 +00:00
Connection.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
ConstString.cpp Remove unused function 'SetMangledCounterparts' (NFC) 2019-08-06 04:01:58 +00:00
DataBufferHeap.cpp [Utility] Modernize C-style cats 2019-05-23 05:12:11 +00:00
DataBufferLLVM.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
DataEncoder.cpp [Utility] Modernize C-style cats 2019-05-23 05:12:11 +00:00
DataExtractor.cpp [lldb] Fix out of bounds read in DataExtractor::GetCStr and add unit test that function. 2019-10-10 11:15:38 +00:00
Environment.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
Event.cpp [Utility] Modernize C-style cats 2019-05-23 05:12:11 +00:00
FileSpec.cpp Fix variable mismatch between signature and body 2019-08-15 05:09:09 +00:00
GDBRemote.cpp [NFC] Move dumping into GDBRemotePacket 2019-09-16 20:02:57 +00:00
IOObject.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
LLDBAssert.cpp [LLDBAssert] Use unreachable instead of assert(0) 2019-07-05 21:54:20 +00:00
Listener.cpp [Logging] Replace Log::Printf with LLDB_LOG macro (NFC) 2019-07-24 17:56:10 +00:00
Log.cpp [lldb] Fix log output and UtilityTests/LogChannelTest.List 2019-09-24 08:20:05 +00:00
Logging.cpp [Logging] Replace LogIfAnyCategoriesSet with LLDB_LOG. 2019-07-22 23:48:01 +00:00
NameMatches.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
PPC64LE_DWARF_Registers.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
PPC64LE_ehframe_Registers.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
PPC64_DWARF_Registers.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
ProcessInfo.cpp Revert "ProcessInstanceInfoMatch: Don't match processes with no name if a name match was requested" 2019-10-08 01:16:59 +00:00
RegisterValue.cpp [Utility] Modernize C-style cats 2019-05-23 05:12:11 +00:00
RegularExpression.cpp [lldb] Use the new Regex::isValid() with no parameter 2019-08-20 16:08:27 +00:00
Reproducer.cpp [Reproducer] Always use absolute paths for capture & replay. 2019-09-27 17:30:40 +00:00
ReproducerInstrumentation.cpp [Reproducers] Limit logging to calls that cross the API boundary. 2019-04-23 17:44:40 +00:00
Scalar.cpp [LLDB] Remove a stray semicolon. NFC. 2019-09-23 12:03:14 +00:00
SelectHelper.cpp [LLDB] Check for _WIN32 instead of _MSC_VER for code specific to windows in general 2019-09-23 12:03:56 +00:00
SharingPtr.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
State.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
Status.cpp Delete unnecessary copy ctors/copy assignment operators 2019-05-15 11:23:54 +00:00
Stream.cpp [Utility] Modernize C-style cats 2019-05-23 05:12:11 +00:00
StreamCallback.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
StreamString.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
StringExtractor.cpp [NFC] Remove unused function GetHexWithFixedSize 2019-08-21 04:55:53 +00:00
StringExtractorGDBRemote.cpp Create a generic handler for Xfer packets 2019-06-10 20:59:58 +00:00
StringLexer.cpp [NFC] Remove lldb_utility namespace. 2019-08-21 00:50:46 +00:00
StringList.cpp [lldb][NFC] Remove StringList::AutoComplete 2019-08-19 08:15:46 +00:00
StructuredData.cpp [JSON] Use LLVM's library for decoding JSON in StructuredData 2019-10-01 17:41:52 +00:00
TildeExpressionResolver.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
Timer.cpp Use correct format specifier to silence -Wformat warning. 2019-05-29 21:25:15 +00:00
UUID.cpp Add UUID::SetFromOptionalStringRef, use it in DynamicLoaderDarwin 2019-01-24 22:43:44 +00:00
UriParser.cpp [NFC] Remove ASCII lines from comments 2019-04-10 20:48:55 +00:00
UserID.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
UserIDResolver.cpp Refactor user/group name resolving code 2019-03-04 18:48:00 +00:00
UuidCompatibility.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
VASprintf.cpp Fix file names in file headers. NFC 2019-05-13 04:42:32 +00:00
VMRange.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00