aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/effects/SkMatrixConvolutionImageFilter.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/effects/SkMatrixConvolutionImageFilter.cpp b/src/effects/SkMatrixConvolutionImageFilter.cpp
index 2119a8b108..153c6f4c48 100644
--- a/src/effects/SkMatrixConvolutionImageFilter.cpp
+++ b/src/effects/SkMatrixConvolutionImageFilter.cpp
@@ -90,6 +90,9 @@ sk_sp<SkFlattenable> SkMatrixConvolutionImageFilter::CreateProc(SkReadBuffer& bu
if (!buffer.validate(kernelArea == count)) {
return nullptr;
}
+ if (!buffer.validateCanReadN<SkScalar>(count)) {
+ return nullptr;
+ }
SkAutoSTArray<16, SkScalar> kernel(count);
if (!buffer.readScalarArray(kernel.get(), count)) {
return nullptr;
@@ -103,6 +106,9 @@ sk_sp<SkFlattenable> SkMatrixConvolutionImageFilter::CreateProc(SkReadBuffer& bu
TileMode tileMode = buffer.read32LE(kLast_TileMode);
bool convolveAlpha = buffer.readBool();
+ if (!buffer.isValid()) {
+ return nullptr;
+ }
return Make(kernelSize, kernel.get(), gain, bias, kernelOffset, tileMode,
convolveAlpha, common.getInput(0), &common.cropRect());
}