From 2a223358ed19f3dd25f9b127aa21f1dd138cb9f0 Mon Sep 17 00:00:00 2001 From: Mike Reed Date: Tue, 6 Feb 2018 16:58:21 -0500 Subject: [PATCH] init matrix if buffer is already bad Bug: skia: Change-Id: I8d21d846a0657a1e9530adc6613d398932b69e5f Reviewed-on: https://skia-review.googlesource.com/104660 Commit-Queue: Kevin Lubick Reviewed-by: Kevin Lubick --- src/core/SkReadBuffer.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/core/SkReadBuffer.cpp b/src/core/SkReadBuffer.cpp index d82ec4a046..73e7af0fd7 100644 --- a/src/core/SkReadBuffer.cpp +++ b/src/core/SkReadBuffer.cpp @@ -182,9 +182,10 @@ void SkReadBuffer::readMatrix(SkMatrix* matrix) { size_t size = 0; if (this->isValid()) { size = SkMatrixPriv::ReadFromMemory(matrix, fReader.peek(), fReader.available()); - if (!this->validate((SkAlign4(size) == size) && (0 != size))) { - matrix->reset(); - } + (void)this->validate((SkAlign4(size) == size) && (0 != size)); + } + if (!this->isValid()) { + matrix->reset(); } (void)this->skip(size); }