Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1346)

Unified Diff: src/effects/SkMergeImageFilter.cpp

Issue 23021015: Initial error handling code (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Serialization with strings as ID Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/effects/SkMergeImageFilter.cpp
diff --git a/src/effects/SkMergeImageFilter.cpp b/src/effects/SkMergeImageFilter.cpp
index 020533046df7500e4fd2923cb51ed7230bce1a55..8c27861c4f6a25583c5761636e1a6f73dd8af3d5 100755
--- a/src/effects/SkMergeImageFilter.cpp
+++ b/src/effects/SkMergeImageFilter.cpp
@@ -9,6 +9,7 @@
#include "SkCanvas.h"
#include "SkDevice.h"
#include "SkFlattenableBuffers.h"
+#include "SkValidationUtils.h"
///////////////////////////////////////////////////////////////////////////////
@@ -159,8 +160,12 @@ SkMergeImageFilter::SkMergeImageFilter(SkFlattenableReadBuffer& buffer) : INHERI
bool hasModes = buffer.readBool();
if (hasModes) {
this->initAllocModes();
- SkASSERT(buffer.getArrayCount() == countInputs() * sizeof(fModes[0]));
+ int nbInputs = countInputs();
+ SkASSERT(buffer.getArrayCount() == nbInputs * sizeof(fModes[0]));
buffer.readByteArray(fModes);
+ for (int i = 0; i < nbInputs; ++i) {
+ buffer.validate(SkIsValidMode((SkXfermode::Mode)fModes[i]));
+ }
} else {
fModes = 0;
}

Powered by Google App Engine
This is Rietveld 408576698