Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(160)

Unified Diff: src/core/SkRegion.cpp

Issue 61913002: Adding error checks to SkRBuffer (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Added doc Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkPathRef.cpp ('k') | src/core/SkValidatingReadBuffer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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));
}
« no previous file with comments | « src/core/SkPathRef.cpp ('k') | src/core/SkValidatingReadBuffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698