llvm-project/lldb/unittests
Pavel Labath f7e7fdd5cf Fix DataExtractor::PeekData for zero length peeks
Summary:
The function was returning the null pointer for peeks of size zero, which seems like a sensible
thing to do, but is actually pretty easy to get bitten by that if you are extracting a variable
length field which happens to be of zero length and then doing pointer arithmetic on that (which
SymbolFileDWARF does, and ended up crashing in case of empty DW_AT_location).

This changes the function to return a null pointer only when it gets queried for data which is
outside of the range of the extractor, which is more c++-y, as one can still do reasonable things
with pointers to data of size zero (think, end() iterators).

I also add a test and fix some signedness warnings in the existing data extractor tests.

Reviewers: clayborg

Subscribers: lldb-commits

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

llvm-svn: 276734
2016-07-26 08:11:57 +00:00
..
Core Fix DataExtractor::PeekData for zero length peeks 2016-07-26 08:11:57 +00:00
Editline Fix a bunch of signedness warnings in unittests 2016-03-11 09:00:23 +00:00
Expression Fix build for go parser unittest. 2015-11-03 22:46:37 +00:00
Host Revert "Add a read_full_buffer argument to ConnectionFileDescriptor::Read" 2016-05-03 14:07:41 +00:00
Interpreter Fix linking of unit tests via CMake on Windows. 2015-03-18 16:56:24 +00:00
ScriptInterpreter Fix a no newline at end of file warning. 2016-06-09 18:06:09 +00:00
Symbol Add some unit tests for ClangASTContext. 2016-04-01 23:20:35 +00:00
SymbolFile Fix SymbolFilePDBTests.cpp 2016-05-10 13:46:22 +00:00
Utility Add unit tests for ModuleCache 2016-05-25 10:48:16 +00:00
CMakeLists.txt Add some unit tests for ClangASTContext. 2016-04-01 23:20:35 +00:00
gtest_common.h Fix linking of unit tests via CMake on Windows. 2015-03-18 16:56:24 +00:00