diff options
author | Torne (Richard Coles) <torne@google.com> | 2014-01-09 14:05:28 +0000 |
---|---|---|
committer | Torne (Richard Coles) <torne@google.com> | 2014-01-09 14:05:28 +0000 |
commit | 99354f9da3d8694db5a42061558c21ca480439d5 (patch) | |
tree | c3f11a8f49b6d4ab22904888ab2e25ad95496125 | |
parent | 4dea14523691a3e2904f6b7614b6a1e01a7b537d (diff) | |
parent | eb8698b339a00a3c1ed94f70d163e9d201b331d9 (diff) | |
download | src-99354f9da3d8694db5a42061558c21ca480439d5.tar.gz |
Merge third_party/skia/src from https://chromium.googlesource.com/a/external/skia/src.git at eb8698b339a00a3c1ed94f70d163e9d201b331d9
This commit was generated by merge_from_chromium.py.
Change-Id: If7f25687daab6821deb92dc1c5a765dc5d9ec35a
-rw-r--r-- | core/SkImageInfo.cpp | 10 | ||||
-rw-r--r-- | core/SkMallocPixelRef.cpp | 2 | ||||
-rw-r--r-- | core/SkRegion_path.cpp | 5 |
3 files changed, 16 insertions, 1 deletions
diff --git a/core/SkImageInfo.cpp b/core/SkImageInfo.cpp index 461bdc03..967b4f6f 100644 --- a/core/SkImageInfo.cpp +++ b/core/SkImageInfo.cpp @@ -8,6 +8,14 @@ #include "SkImageInfo.h" #include "SkFlattenableBuffers.h" +static bool alpha_type_is_valid(SkAlphaType alphaType) { + return (alphaType >= 0) && (alphaType <= kLastEnum_SkAlphaType); +} + +static bool color_type_is_valid(SkColorType colorType) { + return (colorType >= 0) && (colorType <= kLastEnum_SkColorType); +} + void SkImageInfo::unflatten(SkFlattenableReadBuffer& buffer) { fWidth = buffer.read32(); fHeight = buffer.read32(); @@ -16,6 +24,8 @@ void SkImageInfo::unflatten(SkFlattenableReadBuffer& buffer) { SkASSERT(0 == (packed >> 16)); fAlphaType = (SkAlphaType)((packed >> 8) & 0xFF); fColorType = (SkColorType)((packed >> 0) & 0xFF); + buffer.validate(alpha_type_is_valid(fAlphaType) && + color_type_is_valid(fColorType)); } void SkImageInfo::flatten(SkFlattenableWriteBuffer& buffer) const { diff --git a/core/SkMallocPixelRef.cpp b/core/SkMallocPixelRef.cpp index 25337e7b..d3bf9d18 100644 --- a/core/SkMallocPixelRef.cpp +++ b/core/SkMallocPixelRef.cpp @@ -142,7 +142,7 @@ SkMallocPixelRef::SkMallocPixelRef(SkFlattenableReadBuffer& buffer) , fOwnPixels(true) { fRB = buffer.read32(); - size_t size = this->info().getSafeSize(fRB); + size_t size = buffer.isValid() ? this->info().getSafeSize(fRB) : 0; fStorage = sk_malloc_throw(size); buffer.readByteArray(fStorage, size); if (buffer.readBool()) { diff --git a/core/SkRegion_path.cpp b/core/SkRegion_path.cpp index ec4d9f01..98e937cb 100644 --- a/core/SkRegion_path.cpp +++ b/core/SkRegion_path.cpp @@ -15,6 +15,7 @@ class SkRgnBuilder : public SkBlitter { public: + SkRgnBuilder(); virtual ~SkRgnBuilder(); // returns true if it could allocate the working storage needed @@ -98,6 +99,10 @@ private: } }; +SkRgnBuilder::SkRgnBuilder() + : fStorage(NULL) { +} + SkRgnBuilder::~SkRgnBuilder() { sk_free(fStorage); } |