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

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

Issue 1341753003: SkValidatingReadBuffer: make sure we don't call readTypeface(). (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 3 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
« no previous file with comments | « no previous file | 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 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 return readArray(values, size, sizeof(SkScalar)); 206 return readArray(values, size, sizeof(SkScalar));
207 } 207 }
208 208
209 uint32_t SkValidatingReadBuffer::getArrayCount() { 209 uint32_t SkValidatingReadBuffer::getArrayCount() {
210 const size_t inc = sizeof(uint32_t); 210 const size_t inc = sizeof(uint32_t);
211 fError = fError || !IsPtrAlign4(fReader.peek()) || !fReader.isAvailable(inc) ; 211 fError = fError || !IsPtrAlign4(fReader.peek()) || !fReader.isAvailable(inc) ;
212 return fError ? 0 : *(uint32_t*)fReader.peek(); 212 return fError ? 0 : *(uint32_t*)fReader.peek();
213 } 213 }
214 214
215 SkTypeface* SkValidatingReadBuffer::readTypeface() { 215 SkTypeface* SkValidatingReadBuffer::readTypeface() {
216 SkASSERT(false);
216 // TODO: Implement this (securely) when needed 217 // TODO: Implement this (securely) when needed
217 return nullptr; 218 return nullptr;
218 } 219 }
219 220
220 bool SkValidatingReadBuffer::validateAvailable(size_t size) { 221 bool SkValidatingReadBuffer::validateAvailable(size_t size) {
221 return this->validate((size <= SK_MaxU32) && fReader.isAvailable(static_cast <uint32_t>(size))); 222 return this->validate((size <= SK_MaxU32) && fReader.isAvailable(static_cast <uint32_t>(size)));
222 } 223 }
223 224
224 SkFlattenable* SkValidatingReadBuffer::readFlattenable(SkFlattenable::Type type) { 225 SkFlattenable* SkValidatingReadBuffer::readFlattenable(SkFlattenable::Type type) {
225 SkString name; 226 SkString name;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 266
266 void SkValidatingReadBuffer::skipFlattenable() { 267 void SkValidatingReadBuffer::skipFlattenable() {
267 SkString name; 268 SkString name;
268 this->readString(&name); 269 this->readString(&name);
269 if (fError) { 270 if (fError) {
270 return; 271 return;
271 } 272 }
272 uint32_t sizeRecorded = this->readUInt(); 273 uint32_t sizeRecorded = this->readUInt();
273 this->skip(sizeRecorded); 274 this->skip(sizeRecorded);
274 } 275 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698