[Lldb-commits] [PATCH] D50149: Fix out-of-bounds read in Stream::PutCStringAsRawHex8
Raphael Isemann via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Wed Aug 1 14:07:49 PDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL338637: Fix out-of-bounds read in Stream::PutCStringAsRawHex8 (authored by teemperor, committed by ).
Herald added a subscriber: llvm-commits.
Changed prior to commit:
https://reviews.llvm.org/D50149?vs=158569&id=158632#toc
Repository:
rL LLVM
https://reviews.llvm.org/D50149
Files:
lldb/trunk/source/Utility/Stream.cpp
lldb/trunk/unittests/Utility/StreamTest.cpp
Index: lldb/trunk/unittests/Utility/StreamTest.cpp
===================================================================
--- lldb/trunk/unittests/Utility/StreamTest.cpp
+++ lldb/trunk/unittests/Utility/StreamTest.cpp
@@ -106,6 +106,9 @@
}
TEST_F(StreamTest, PutCStringAsRawHex8) {
+ s.PutCStringAsRawHex8("");
+ EXPECT_EQ("", TakeValue());
+
s.PutCStringAsRawHex8("foobar");
EXPECT_EQ("666f6f626172", TakeValue());
Index: lldb/trunk/source/Utility/Stream.cpp
===================================================================
--- lldb/trunk/source/Utility/Stream.cpp
+++ lldb/trunk/source/Utility/Stream.cpp
@@ -518,10 +518,10 @@
size_t bytes_written = 0;
bool binary_is_set = m_flags.Test(eBinary);
m_flags.Clear(eBinary);
- do {
+ while(*s) {
bytes_written += _PutHex8(*s, false);
++s;
- } while (*s);
+ }
if (binary_is_set)
m_flags.Set(eBinary);
return bytes_written;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D50149.158632.patch
Type: text/x-patch
Size: 918 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20180801/cb5c79b1/attachment.bin>
More information about the lldb-commits
mailing list