Index: src/core/SkImageFilter.cpp |
diff --git a/src/core/SkImageFilter.cpp b/src/core/SkImageFilter.cpp |
index 2a221fb869db95371fbea1d45162e490d474cf8f..cda635b4fbf1d8b6d6b2a72c3ff232013fefb060 100644 |
--- a/src/core/SkImageFilter.cpp |
+++ b/src/core/SkImageFilter.cpp |
@@ -61,10 +61,14 @@ SkImageFilter::SkImageFilter(int inputCount, SkFlattenableReadBuffer& buffer) { |
} else { |
fInputs[i] = NULL; |
} |
+ if (!buffer.isValid()) { |
+ fInputCount = i; // Do not use fInputs past that point in the destructor |
+ break; |
+ } |
} |
SkRect rect; |
buffer.readRect(&rect); |
- if (buffer.validate(SkIsValidRect(rect))) { |
+ if (buffer.isValid() && buffer.validate(SkIsValidRect(rect))) { |
uint32_t flags = buffer.readUInt(); |
fCropRect = CropRect(rect, flags); |
} |