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

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: Created 7 years, 3 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 b8247ab566744f95bdf0643d17084bd8bd7064b2..e10b2d5a1d8ac559617a90aaf234c44cc1a19cb6 100644
--- a/src/core/SkValidatingReadBuffer.cpp
+++ b/src/core/SkValidatingReadBuffer.cpp
@@ -92,6 +92,10 @@ const void* SkValidatingReadBuffer::skip(size_t size) {
}
bool SkValidatingReadBuffer::readBool() {
+ const void* addr = fReader.peek();
+ const uint32_t* boolPtr = static_cast<const uint32_t*>(addr);
+ // Boolean value should be either 0 or 1
+ fError |= !boolPtr || (*boolPtr) & 0xFFFFFFFE;
reed1 2013/09/13 15:42:56 Why are we dealing with ptrs and casts here? Why n
sugoi1 2013/09/13 16:53:44 You're right, I was originally thinking of a more
return this->readInt() != 0;
}

Powered by Google App Engine
This is Rietveld 408576698