From b2526041ba83a66ba66be237d9e83578ed6f2c1c Mon Sep 17 00:00:00 2001 From: Robert Phillips Date: Mon, 26 Sep 2016 09:00:36 -0400 Subject: 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 --- tests/SerializationTest.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'tests/SerializationTest.cpp') 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(buffer2.skip(0)); + size_t offsetBefore = buffer2.offset(); T obj2; SerializationUtils::Read(buffer2, &obj2); - const unsigned char* peekAfter = static_cast(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(peekAfter - peekBefore) == bytesWritten); + REPORTER_ASSERT(reporter, offsetAfter - offsetBefore == bytesWritten); } template -- cgit v1.2.3