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

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

Issue 255693003: Fixed issue found by clusterfuzz (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fixed nit Created 6 years, 7 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 | « include/core/SkReader32.h ('k') | src/core/SkWriter32.cpp » ('j') | 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 84
85 uint32_t SkValidatingReadBuffer::readUInt() { 85 uint32_t SkValidatingReadBuffer::readUInt() {
86 return this->readInt(); 86 return this->readInt();
87 } 87 }
88 88
89 int32_t SkValidatingReadBuffer::read32() { 89 int32_t SkValidatingReadBuffer::read32() {
90 return this->readInt(); 90 return this->readInt();
91 } 91 }
92 92
93 void SkValidatingReadBuffer::readString(SkString* string) { 93 void SkValidatingReadBuffer::readString(SkString* string) {
94 const size_t len = this->readInt(); 94 const size_t len = this->readUInt();
95 const void* ptr = fReader.peek(); 95 const void* ptr = fReader.peek();
96 const char* cptr = (const char*)ptr; 96 const char* cptr = (const char*)ptr;
97 97
98 // skip over the string + '\0' and then pad to a multiple of 4 98 // skip over the string + '\0' and then pad to a multiple of 4
99 const size_t alignedSize = SkAlign4(len + 1); 99 const size_t alignedSize = SkAlign4(len + 1);
100 this->skip(alignedSize); 100 this->skip(alignedSize);
101 if (!fError) { 101 if (!fError) {
102 this->validate(cptr[len] == '\0'); 102 this->validate(cptr[len] == '\0');
103 } 103 }
104 if (!fError) { 104 if (!fError) {
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 delete obj; 266 delete obj;
267 obj = NULL; 267 obj = NULL;
268 } 268 }
269 } else { 269 } else {
270 // we must skip the remaining data 270 // we must skip the remaining data
271 this->skip(sizeRecorded); 271 this->skip(sizeRecorded);
272 SkASSERT(false); 272 SkASSERT(false);
273 } 273 }
274 return obj; 274 return obj;
275 } 275 }
OLDNEW
« no previous file with comments | « include/core/SkReader32.h ('k') | src/core/SkWriter32.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698