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

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: Merged in changes from 23021015 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/core/SkValidatingReadBuffer.cpp
diff --git a/src/core/SkValidatingReadBuffer.cpp b/src/core/SkValidatingReadBuffer.cpp
index 0ffe650787fe7b698ad0dc17b32568517e28dd1f..2d4b708435e84c4b8ff6d4684eca154882ddcb3f 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();
Stephen White 2013/10/23 18:09:35 Not new to this patch, but some flavours of writeB
sugoi1 2013/10/23 18:17:08 Yeah, I had to check that noone was doing any kind
+ // Boolean value should be either 0 or 1
+ if (value & 0xFFFFFFFE) {
reed1 2013/10/23 17:58:42 this is correct, but possibly hard for a reviewer
sugoi1 2013/10/23 18:07:43 Done.
+ fError = true;
+ }
+ return value != 0;
}
SkColor SkValidatingReadBuffer::readColor() {
« no previous file with comments | « no previous file | src/effects/SkMatrixConvolutionImageFilter.cpp » ('j') | src/effects/SkMatrixConvolutionImageFilter.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698