[all-commits] [llvm/llvm-project] a16fff: [Support] Make DataExtractor string functions erro...
Pavel Labath via All-commits
all-commits at lists.llvm.org
Mon Apr 6 05:14:18 PDT 2020
Branch: refs/heads/master
Home: https://github.com/llvm/llvm-project
Commit: a16fffa3f6add51fe1c6ee975ace56aa06a3bea7
https://github.com/llvm/llvm-project/commit/a16fffa3f6add51fe1c6ee975ace56aa06a3bea7
Author: Pavel Labath <pavel at labath.sk>
Date: 2020-04-06 (Mon, 06 Apr 2020)
Changed paths:
M llvm/include/llvm/Support/DataExtractor.h
M llvm/lib/Support/DataExtractor.cpp
M llvm/unittests/Support/DataExtractorTest.cpp
Log Message:
-----------
[Support] Make DataExtractor string functions error-aware
Summary:
This patch adds an optional Error argument to DataExtractor functions
for string extraction, and makes them behave like other DataExtractor
functions (set the error if extraction fails, don't do anything if the
error is already set).
I have merged the StringRef and C string versions of the functions to
reduce code duplication.
Reviewers: dblaikie, MaskRay
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D77307
Commit: 9154a6398eda31bfbfac3291250a2968629ebc78
https://github.com/llvm/llvm-project/commit/9154a6398eda31bfbfac3291250a2968629ebc78
Author: Pavel Labath <pavel at labath.sk>
Date: 2020-04-06 (Mon, 06 Apr 2020)
Changed paths:
M llvm/include/llvm/Support/DataExtractor.h
M llvm/lib/Support/DataExtractor.cpp
M llvm/unittests/Support/DataExtractorTest.cpp
Log Message:
-----------
[llvm/Support] Make more DataExtractor methods error-aware
Summary:
This patch adds the optional Error argument, and the Cursor variants to
more DataExtractor methods. The functions now behave the same way as
other error-aware functions (they set the error when they fail, and
don't do anything if the error is already set).
I have merged the LEB128 implementations via a template (similarly to
how fixed-size functions are handled) to reduce code duplication.
Depends on D77304.
Reviewers: dblaikie, aprantl
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D77306
Commit: 8f1233699bf64fca1a94dcffe955396f05fdb957
https://github.com/llvm/llvm-project/commit/8f1233699bf64fca1a94dcffe955396f05fdb957
Author: Pavel Labath <pavel at labath.sk>
Date: 2020-04-06 (Mon, 06 Apr 2020)
Changed paths:
M llvm/include/llvm/Support/LEB128.h
M llvm/unittests/Support/LEB128Test.cpp
Log Message:
-----------
[llvm/Support] Don't crash on empty nullptr ranges when decoding LEBs
Summary:
If the decoding functions are called with both start and end pointers
being nullptr, the function will crash due to a nullptr dereference.
This happens because the function does not recognise nullptr as a valid
end pointer.
Obviously, nobody is going to pass null pointers here deliberately, but
it can happen indirectly (as it did for me), when calling these
functions on an ArrayRef, as a default-initialized empty ArrayRef will
have both begin() and end() pointers equal to nullptr.
The fix is to simply remove the nullptr check. Passing nullptr for "end"
with a valid "begin" pointer will still work, as one cannot reach
nullptr by incrementing a valid pointer without triggerring UB.
Reviewers: dblaikie
Subscribers: llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D77304
Compare: https://github.com/llvm/llvm-project/compare/ff858d77810a...8f1233699bf6
More information about the All-commits
mailing list