From 9e5f85e89d03a850d435fc951e74e9861a0c1bdd Mon Sep 17 00:00:00 2001 From: "commit-bot@chromium.org" Date: Wed, 12 Mar 2014 14:46:41 +0000 Subject: Fixing SkPicture serialization Fixed a few issues while attempting to use the new serialization path for SkPicture inside a fuzzer: - SkReadBuffer and SkValidatingReadBuffer both had a fReader member instead of sharing the same member, which leads to problems if a base class function is used - In SkPicture, a header is now written as a single chunk of data, so it also has to be read as a single chunk of data - In the SkPicturePlayback destructor, a bad deserialization would lead to a crash if we don't safely unref fOpData - Also in SkPicturePlayback, if we only use a ReadBuffer for the whole deserialization, additional tags must be added to parseBufferTag() - SkValidatingReadBuffer::readBitmap() was broken, but this path wasn't usen't since the only use case for SkValidatingReadBuffer is currently image filters and bitmaps are unflattened as part of the deserialization of SkBitmapSource - SkPictureImageFilter was not deserializable. Added it to SkGlobalInitialization* - Added a test that exercises the SkPicture serialization / deserialization code BUG=skia: R=senorblanco@google.com, senorblanco@chromium.org, reed@google.com, robertphillips@google.com Author: sugoi@chromium.org Review URL: https://codereview.chromium.org/195223003 git-svn-id: http://skia.googlecode.com/svn/trunk@13764 2bbb7eff-a529-9590-31e7-b0007b416f81 --- src/core/SkValidatingReadBuffer.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/core/SkValidatingReadBuffer.cpp') diff --git a/src/core/SkValidatingReadBuffer.cpp b/src/core/SkValidatingReadBuffer.cpp index ae7a83684b..8db2c68b9a 100644 --- a/src/core/SkValidatingReadBuffer.cpp +++ b/src/core/SkValidatingReadBuffer.cpp @@ -213,10 +213,10 @@ uint32_t SkValidatingReadBuffer::getArrayCount() { void SkValidatingReadBuffer::readBitmap(SkBitmap* bitmap) { const int width = this->readInt(); const int height = this->readInt(); + const bool useBitmapHeap = this->readBool(); const size_t length = this->readUInt(); // A size of zero means the SkBitmap was simply flattened. - this->validate(length == 0); - if (fError) { + if (!this->validate(!useBitmapHeap && (0 == length))) { return; } bitmap->unflatten(*this); -- cgit v1.2.3