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

Side by Side Diff: src/core/SkValidatingReadBuffer.cpp

Issue 317003003: Fixing another clusterfuzz issue (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 6 months 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 unified diff | Download patch
« src/core/SkReadBuffer.cpp ('K') | « src/core/SkValidatingReadBuffer.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2013 Google Inc. 2 * Copyright 2013 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkBitmap.h" 8 #include "SkBitmap.h"
9 #include "SkErrorInternals.h" 9 #include "SkErrorInternals.h"
10 #include "SkValidatingReadBuffer.h" 10 #include "SkValidatingReadBuffer.h"
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 *length = this->readInt(); 112 *length = this->readInt();
113 const void* ptr = this->skip(SkAlign4(*length)); 113 const void* ptr = this->skip(SkAlign4(*length));
114 void* data = NULL; 114 void* data = NULL;
115 if (!fError) { 115 if (!fError) {
116 data = sk_malloc_throw(*length); 116 data = sk_malloc_throw(*length);
117 memcpy(data, ptr, *length); 117 memcpy(data, ptr, *length);
118 } 118 }
119 return data; 119 return data;
120 } 120 }
121 121
122 void SkValidatingReadBuffer::readPoint(SkPoint* point) {
123 point->fX = this->readScalar();
124 point->fY = this->readScalar();
125 }
126
127 void SkValidatingReadBuffer::readMatrix(SkMatrix* matrix) { 122 void SkValidatingReadBuffer::readMatrix(SkMatrix* matrix) {
128 size_t size = 0; 123 size_t size = 0;
129 if (!fError) { 124 if (!fError) {
130 size = matrix->readFromMemory(fReader.peek(), fReader.available()); 125 size = matrix->readFromMemory(fReader.peek(), fReader.available());
131 this->validate((SkAlign4(size) == size) && (0 != size)); 126 this->validate((SkAlign4(size) == size) && (0 != size));
132 } 127 }
133 if (!fError) { 128 if (!fError) {
134 (void)this->skip(size); 129 (void)this->skip(size);
135 } 130 }
136 } 131 }
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 258
264 void SkValidatingReadBuffer::skipFlattenable() { 259 void SkValidatingReadBuffer::skipFlattenable() {
265 SkString name; 260 SkString name;
266 this->readString(&name); 261 this->readString(&name);
267 if (fError) { 262 if (fError) {
268 return; 263 return;
269 } 264 }
270 uint32_t sizeRecorded = this->readUInt(); 265 uint32_t sizeRecorded = this->readUInt();
271 this->skip(sizeRecorded); 266 this->skip(sizeRecorded);
272 } 267 }
OLDNEW
« src/core/SkReadBuffer.cpp ('K') | « src/core/SkValidatingReadBuffer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698