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

Unified Diff: src/core/SkValidatingReadBuffer.cpp

Issue 83073005: Fixing issues found by fuzzer (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 1 month 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 | no next file » | 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 1be142d40f931a8d68a6bade4bc7c9cbae9242c4..a92c1b9b6fb7d527584661676d9e61f04d9a11fc 100644
--- a/src/core/SkValidatingReadBuffer.cpp
+++ b/src/core/SkValidatingReadBuffer.cpp
@@ -94,14 +94,16 @@ void SkValidatingReadBuffer::readString(SkString* string) {
// skip over the string + '\0' and then pad to a multiple of 4
const size_t alignedSize = SkAlign4(len + 1);
this->skip(alignedSize);
- this->validate(cptr[len] == '\0');
+ if (!fError) {
+ this->validate(cptr[len] == '\0');
+ }
if (!fError) {
string->set(cptr, len);
}
}
void* SkValidatingReadBuffer::readEncodedString(size_t* length, SkPaint::TextEncoding encoding) {
- const int32_t encodingType = fReader.readInt();
+ const int32_t encodingType = this->readInt();
this->validate(encodingType == encoding);
*length = this->readInt();
const void* ptr = this->skip(SkAlign4(*length));
@@ -114,8 +116,8 @@ void* SkValidatingReadBuffer::readEncodedString(size_t* length, SkPaint::TextEnc
}
void SkValidatingReadBuffer::readPoint(SkPoint* point) {
- point->fX = fReader.readScalar();
- point->fY = fReader.readScalar();
+ point->fX = this->readScalar();
+ point->fY = this->readScalar();
}
void SkValidatingReadBuffer::readMatrix(SkMatrix* matrix) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698