Fixing issues found by fuzzer
BUG=321802,321790 R=reed@google.com, senorblanco@google.com Author: sugoi@chromium.org Review URL: https://codereview.chromium.org/83073005 git-svn-id: http://skia.googlecode.com/svn/trunk@12362 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
parent
da095e9a3b
commit
46a9bb8d71
@ -94,14 +94,16 @@ void SkValidatingReadBuffer::readString(SkString* string) {
|
|||||||
// skip over the string + '\0' and then pad to a multiple of 4
|
// skip over the string + '\0' and then pad to a multiple of 4
|
||||||
const size_t alignedSize = SkAlign4(len + 1);
|
const size_t alignedSize = SkAlign4(len + 1);
|
||||||
this->skip(alignedSize);
|
this->skip(alignedSize);
|
||||||
this->validate(cptr[len] == '\0');
|
if (!fError) {
|
||||||
|
this->validate(cptr[len] == '\0');
|
||||||
|
}
|
||||||
if (!fError) {
|
if (!fError) {
|
||||||
string->set(cptr, len);
|
string->set(cptr, len);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void* SkValidatingReadBuffer::readEncodedString(size_t* length, SkPaint::TextEncoding encoding) {
|
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);
|
this->validate(encodingType == encoding);
|
||||||
*length = this->readInt();
|
*length = this->readInt();
|
||||||
const void* ptr = this->skip(SkAlign4(*length));
|
const void* ptr = this->skip(SkAlign4(*length));
|
||||||
@ -114,8 +116,8 @@ void* SkValidatingReadBuffer::readEncodedString(size_t* length, SkPaint::TextEnc
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SkValidatingReadBuffer::readPoint(SkPoint* point) {
|
void SkValidatingReadBuffer::readPoint(SkPoint* point) {
|
||||||
point->fX = fReader.readScalar();
|
point->fX = this->readScalar();
|
||||||
point->fY = fReader.readScalar();
|
point->fY = this->readScalar();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SkValidatingReadBuffer::readMatrix(SkMatrix* matrix) {
|
void SkValidatingReadBuffer::readMatrix(SkMatrix* matrix) {
|
||||||
|
Loading…
Reference in New Issue
Block a user