Index: src/core/SkRegion.cpp |
diff --git a/src/core/SkRegion.cpp b/src/core/SkRegion.cpp |
index 0d9198f9f7fbd48d9c191b5118bb81db10c2cbc4..baedf2aea82c2f06a49db288bdaeaa22f243339b 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)); |
} |