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

Side by Side Diff: include/core/SkRegion.h

Issue 41253002: Checking structure sizes before reading them from memory to avoid overflowing the buffer's stream. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Adding length info to read operations 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2005 The Android Open Source Project 3 * Copyright 2005 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #ifndef SkRegion_DEFINED 10 #ifndef SkRegion_DEFINED
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 /** 360 /**
361 * Write the region to the buffer, and return the number of bytes written. 361 * Write the region to the buffer, and return the number of bytes written.
362 * If buffer is NULL, it still returns the number of bytes. 362 * If buffer is NULL, it still returns the number of bytes.
363 */ 363 */
364 uint32_t writeToMemory(void* buffer) const; 364 uint32_t writeToMemory(void* buffer) const;
365 365
366 /** 366 /**
367 * Initialized the region from the buffer, returning the number 367 * Initialized the region from the buffer, returning the number
368 * of bytes actually read. 368 * of bytes actually read.
369 */ 369 */
370 uint32_t readFromMemory(const void* buffer); 370 uint32_t readFromMemory(const void* buffer, uint32_t length);
371 371
372 /** 372 /**
373 * Returns a reference to a global empty region. Just a convenience for 373 * Returns a reference to a global empty region. Just a convenience for
374 * callers that need a const empty region. 374 * callers that need a const empty region.
375 */ 375 */
376 static const SkRegion& GetEmptyRegion(); 376 static const SkRegion& GetEmptyRegion();
377 377
378 SkDEBUGCODE(void dump() const;) 378 SkDEBUGCODE(void dump() const;)
379 SkDEBUGCODE(void validate() const;) 379 SkDEBUGCODE(void validate() const;)
380 SkDEBUGCODE(static void UnitTest();) 380 SkDEBUGCODE(static void UnitTest();)
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 static bool Oper(const SkRegion&, const SkRegion&, SkRegion::Op, SkRegion*); 437 static bool Oper(const SkRegion&, const SkRegion&, SkRegion::Op, SkRegion*);
438 438
439 friend struct RunHead; 439 friend struct RunHead;
440 friend class Iterator; 440 friend class Iterator;
441 friend class Spanerator; 441 friend class Spanerator;
442 friend class SkRgnBuilder; 442 friend class SkRgnBuilder;
443 friend class SkFlatRegion; 443 friend class SkFlatRegion;
444 }; 444 };
445 445
446 #endif 446 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698