diff options
author | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-11-04 21:35:55 +0000 |
---|---|---|
committer | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-11-04 21:35:55 +0000 |
commit | 12a23866fe18e800da1d361d000a359ea36696eb (patch) | |
tree | 68de0db0501417b3fb0c55c736f23c062e2fad18 /src/core/SkRegion.cpp | |
parent | 1e4c4fea1179324ce003d3c838ba135f3d21d943 (diff) |
Revert "Checking structure sizes before reading them from memory to avoid overflowing the buffer's stream."
This reverts commit 6bc22e8ef1ea70a1b58409aa21254358c50f149a.
git-svn-id: http://skia.googlecode.com/svn/trunk@12124 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/core/SkRegion.cpp')
-rw-r--r-- | src/core/SkRegion.cpp | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/src/core/SkRegion.cpp b/src/core/SkRegion.cpp index 468be67154..02994bffb0 100644 --- a/src/core/SkRegion.cpp +++ b/src/core/SkRegion.cpp @@ -1100,9 +1100,9 @@ bool SkRegion::op(const SkRegion& rgna, const SkRegion& rgnb, Op op) { #include "SkBuffer.h" -size_t SkRegion::writeToMemory(void* storage) const { +uint32_t SkRegion::writeToMemory(void* storage) const { if (NULL == storage) { - size_t size = sizeof(int32_t); // -1 (empty), 0 (rect), runCount + uint32_t size = sizeof(int32_t); // -1 (empty), 0 (rect), runCount if (!this->isEmpty()) { size += sizeof(fBounds); if (this->isComplex()) { @@ -1133,11 +1133,11 @@ size_t SkRegion::writeToMemory(void* storage) const { return buffer.pos(); } -size_t SkRegion::readFromMemory(const void* storage, size_t length) { - SkRBufferWithSizeCheck buffer(storage, length); - SkRegion tmp; - int32_t count; - +uint32_t SkRegion::readFromMemory(const void* storage) { + SkRBuffer buffer(storage); + SkRegion tmp; + int32_t count; + count = buffer.readS32(); if (count >= 0) { buffer.read(&tmp.fBounds, sizeof(tmp.fBounds)); @@ -1150,12 +1150,8 @@ size_t SkRegion::readFromMemory(const void* storage, size_t length) { buffer.read(tmp.fRunHead->writable_runs(), count * sizeof(RunType)); } } - size_t sizeRead = 0; - if (buffer.isValid()) { - this->swap(tmp); - sizeRead = buffer.pos(); - } - return sizeRead; + this->swap(tmp); + return buffer.pos(); } /////////////////////////////////////////////////////////////////////////////// |