aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/effects
diff options
context:
space:
mode:
authorGravatar Florin Malita <fmalita@chromium.org>2018-05-10 09:41:38 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-05-10 15:06:16 +0000
commitc2ea327d14801b4001716619c7d002caa37a1574 (patch)
treeb1118c2c34630c407f641687090a93e004ebc3b4 /src/effects
parent328490c6a1625ce51d0e81688e0c85c79c400d86 (diff)
Validate readByteArrayAsData size
Check that the reader has enough data before attempting to allocate the buffer. Also update to return nullptr on read failures. Change-Id: Ia1ea8f611bad95cf3a4493b12582ac3fa7c2b00f Reviewed-on: https://skia-review.googlesource.com/127129 Reviewed-by: Kevin Lubick <kjlubick@google.com> Commit-Queue: Florin Malita <fmalita@chromium.org>
Diffstat (limited to 'src/effects')
-rw-r--r--src/effects/SkToSRGBColorFilter.cpp5
1 files changed, 1 insertions, 4 deletions
diff --git a/src/effects/SkToSRGBColorFilter.cpp b/src/effects/SkToSRGBColorFilter.cpp
index 0e9a8c98e1..d2020ef338 100644
--- a/src/effects/SkToSRGBColorFilter.cpp
+++ b/src/effects/SkToSRGBColorFilter.cpp
@@ -64,10 +64,7 @@ SkToSRGBColorFilter::SkToSRGBColorFilter(sk_sp<SkColorSpace> srcColorSpace)
sk_sp<SkFlattenable> SkToSRGBColorFilter::CreateProc(SkReadBuffer& buffer) {
auto data = buffer.readByteArrayAsData();
- if (data) {
- return Make(SkColorSpace::Deserialize(data->data(), data->size()));
- }
- return nullptr;
+ return data ? Make(SkColorSpace::Deserialize(data->data(), data->size())) : nullptr;
}
void SkToSRGBColorFilter::flatten(SkWriteBuffer& buffer) const {