diff options
author | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-11-08 19:22:57 +0000 |
---|---|---|
committer | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-11-08 19:22:57 +0000 |
commit | 8f457e3230f1a4ce737f512ffbb5c919b8d02407 (patch) | |
tree | 1b6cb51813563c2960a4bc19562bb0c2185d89d8 /src/core/SkRegion.cpp | |
parent | 9901727f213e459901a175c119b2fad8816002a0 (diff) |
Adding error checks to SkRBuffer
BUG=
R=robertphillips@google.com, bsalomon@google.com, reed@google.com
Author: sugoi@chromium.org
Review URL: https://codereview.chromium.org/61913002
git-svn-id: http://skia.googlecode.com/svn/trunk@12202 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/core/SkRegion.cpp')
-rw-r--r-- | src/core/SkRegion.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/core/SkRegion.cpp b/src/core/SkRegion.cpp index 0d9198f9f7..baedf2aea8 100644 --- a/src/core/SkRegion.cpp +++ b/src/core/SkRegion.cpp @@ -1138,15 +1138,12 @@ size_t SkRegion::readFromMemory(const void* storage, size_t length) { SkRegion tmp; int32_t count; - count = buffer.readS32(); - if (count >= 0) { - buffer.read(&tmp.fBounds, sizeof(tmp.fBounds)); + if (buffer.readS32(&count) && (count >= 0) && buffer.read(&tmp.fBounds, sizeof(tmp.fBounds))) { if (count == 0) { tmp.fRunHead = SkRegion_gRectRunHeadPtr; } else { - int32_t ySpanCount = buffer.readS32(); - int32_t intervalCount = buffer.readS32(); - if (buffer.isValid()) { + int32_t ySpanCount, intervalCount; + if (buffer.readS32(&ySpanCount) && buffer.readS32(&intervalCount)) { tmp.allocateRuns(count, ySpanCount, intervalCount); buffer.read(tmp.fRunHead->writable_runs(), count * sizeof(RunType)); } |