| Index: src/core/SkValidatingReadBuffer.cpp
|
| diff --git a/src/core/SkValidatingReadBuffer.cpp b/src/core/SkValidatingReadBuffer.cpp
|
| index a0e1a4179f2cd18ff431203aa8b1091102a68ec7..58f67a0dbec2708a1765737a4f16b0ce9c4789a9 100644
|
| --- a/src/core/SkValidatingReadBuffer.cpp
|
| +++ b/src/core/SkValidatingReadBuffer.cpp
|
| @@ -113,10 +113,10 @@ void SkValidatingReadBuffer::readPoint(SkPoint* point) {
|
| }
|
|
|
| void SkValidatingReadBuffer::readMatrix(SkMatrix* matrix) {
|
| - const size_t size = matrix->readFromMemory(fReader.peek());
|
| - fError = fError || (SkAlign4(size) != size);
|
| + const void* addr = this->skip(SkMatrix::SizeToRead());
|
| if (!fError) {
|
| - (void)this->skip(size);
|
| + const size_t size = matrix->readFromMemory(addr);
|
| + fError = fError || (SkAlign4(size) != size);
|
| }
|
| }
|
|
|
| @@ -135,18 +135,18 @@ void SkValidatingReadBuffer::readRect(SkRect* rect) {
|
| }
|
|
|
| void SkValidatingReadBuffer::readRegion(SkRegion* region) {
|
| - const size_t size = region->readFromMemory(fReader.peek());
|
| - fError = fError || (SkAlign4(size) != size);
|
| + const void* addr = this->skip(SkRegion::SizeToRead(*this));
|
| if (!fError) {
|
| - (void)this->skip(size);
|
| + const size_t size = region->readFromMemory(addr);
|
| + fError = fError || (SkAlign4(size) != size);
|
| }
|
| }
|
|
|
| void SkValidatingReadBuffer::readPath(SkPath* path) {
|
| - const size_t size = path->readFromMemory(fReader.peek());
|
| - fError = fError || (SkAlign4(size) != size);
|
| + const void* addr = this->skip(SkPath::SizeToRead(*this));
|
| if (!fError) {
|
| - (void)this->skip(size);
|
| + const size_t size = path->readFromMemory(addr);
|
| + fError = fError || (SkAlign4(size) != size);
|
| }
|
| }
|
|
|
| @@ -205,6 +205,8 @@ uint32_t SkValidatingReadBuffer::readScalarArray(SkScalar* values) {
|
| }
|
|
|
| uint32_t SkValidatingReadBuffer::getArrayCount() {
|
| + const size_t inc = sizeof(uint32_t);
|
| + fError = fError || !IsPtrAlign4(fReader.peek()) || !fReader.isAvailable(inc);
|
| return *(uint32_t*)fReader.peek();
|
| }
|
|
|
|
|