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

Unified Diff: src/core/SkValidatingReadBuffer.cpp

Issue 23548034: Follow up to serialization validation code (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Changed 0xFFFFFFFE for ~1 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
« no previous file with comments | « no previous file | src/effects/SkMatrixConvolutionImageFilter.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkValidatingReadBuffer.cpp
diff --git a/src/core/SkValidatingReadBuffer.cpp b/src/core/SkValidatingReadBuffer.cpp
index 0ffe650787fe7b698ad0dc17b32568517e28dd1f..a0e1a4179f2cd18ff431203aa8b1091102a68ec7 100644
--- a/src/core/SkValidatingReadBuffer.cpp
+++ b/src/core/SkValidatingReadBuffer.cpp
@@ -44,7 +44,12 @@ const void* SkValidatingReadBuffer::skip(size_t size) {
// true, which the caller should check to see if an error occurred during the read operation.
bool SkValidatingReadBuffer::readBool() {
- return this->readInt() != 0;
+ uint32_t value = this->readInt();
+ // Boolean value should be either 0 or 1
+ if (value & ~1) {
+ fError = true;
+ }
+ return value != 0;
}
SkColor SkValidatingReadBuffer::readColor() {
« no previous file with comments | « no previous file | src/effects/SkMatrixConvolutionImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698