diff options
author | Robert Phillips <robertphillips@google.com> | 2016-09-26 09:00:36 -0400 |
---|---|---|
committer | Robert Phillips <robertphillips@google.com> | 2016-09-26 14:47:43 +0000 |
commit | b2526041ba83a66ba66be237d9e83578ed6f2c1c (patch) | |
tree | 55a23c0cfa67363a0c92f992a3be93c5d5919c22 /tests/SerializationTest.cpp | |
parent | 0dc744ac340ee061faf4518be85cc28e38a4471b (diff) |
Fix some fuzzer complaints
In one case the fuzzer was switching the picture's op code to an invalid value
In the other two the fuzzer was maxing out the number of points passed to drawPoints and the number of characters passed to drawTextRSXform. In these cases the validation would fail but still return a pointer into the data stream.
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2593
Change-Id: Id6d4e6b7bcbae38ace7ad1d92ffcfa5c02f9fb61
Reviewed-on: https://skia-review.googlesource.com/2593
Reviewed-by: Mike Reed <reed@google.com>
Diffstat (limited to 'tests/SerializationTest.cpp')
-rw-r--r-- | tests/SerializationTest.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/tests/SerializationTest.cpp b/tests/SerializationTest.cpp index f0412ba48c..24cab3f3fc 100644 --- a/tests/SerializationTest.cpp +++ b/tests/SerializationTest.cpp @@ -170,15 +170,15 @@ static void TestObjectSerializationNoAlign(T* testObj, skiatest::Reporter* repor // Make sure this succeeds when it should SkValidatingReadBuffer buffer2(dataWritten, bytesWritten); - const unsigned char* peekBefore = static_cast<const unsigned char*>(buffer2.skip(0)); + size_t offsetBefore = buffer2.offset(); T obj2; SerializationUtils<T>::Read(buffer2, &obj2); - const unsigned char* peekAfter = static_cast<const unsigned char*>(buffer2.skip(0)); + size_t offsetAfter = buffer2.offset(); // This should have succeeded, since there are enough bytes to read this REPORTER_ASSERT(reporter, buffer2.isValid() == !testInvalid); // Note: This following test should always succeed, regardless of whether the buffer is valid, // since if it is invalid, it will simply skip to the end, as if it had read the whole buffer. - REPORTER_ASSERT(reporter, static_cast<size_t>(peekAfter - peekBefore) == bytesWritten); + REPORTER_ASSERT(reporter, offsetAfter - offsetBefore == bytesWritten); } template<typename T> |