| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |