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

Side by Side Diff: include/core/SkMatrix.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: Created 7 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | include/core/SkPath.h » ('j') | include/core/SkPath.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2006 The Android Open Source Project 3 * Copyright 2006 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 SkMatrix_DEFINED 10 #ifndef SkMatrix_DEFINED
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after
551 friend bool operator==(const SkMatrix& a, const SkMatrix& b); 551 friend bool operator==(const SkMatrix& a, const SkMatrix& b);
552 #endif 552 #endif
553 friend bool operator!=(const SkMatrix& a, const SkMatrix& b) { 553 friend bool operator!=(const SkMatrix& a, const SkMatrix& b) {
554 return !(a == b); 554 return !(a == b);
555 } 555 }
556 556
557 enum { 557 enum {
558 // writeTo/readFromMemory will never return a value larger than this 558 // writeTo/readFromMemory will never return a value larger than this
559 kMaxFlattenSize = 9 * sizeof(SkScalar) + sizeof(uint32_t) 559 kMaxFlattenSize = 9 * sizeof(SkScalar) + sizeof(uint32_t)
560 }; 560 };
561 // return the number of bytes of the current object's flattened representati on
562 uint32_t sizeInMemory() const;
reed1 2013/10/24 20:51:19 Doesn't writeToMemory(NULL) return this same value
563 // return the number of bytes to read
564 static uint32_t SizeToRead();
reed1 2013/10/24 20:51:19 This need not always be the same value for all mat
561 // return the number of bytes written, whether or not buffer is null 565 // return the number of bytes written, whether or not buffer is null
562 uint32_t writeToMemory(void* buffer) const; 566 uint32_t writeToMemory(void* buffer) const;
563 // return the number of bytes read 567 // return the number of bytes read
564 uint32_t readFromMemory(const void* buffer); 568 uint32_t readFromMemory(const void* buffer);
565 569
566 SkDEVCODE(void dump() const;) 570 SkDEVCODE(void dump() const;)
567 SkDEVCODE(void toString(SkString*) const;) 571 SkDEVCODE(void toString(SkString*) const;)
568 572
569 /** 573 /**
570 * Calculates the maximum stretching factor of the matrix. If the matrix has 574 * Calculates the maximum stretching factor of the matrix. If the matrix has
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
690 static void RotTrans_pts(const SkMatrix&, SkPoint dst[], const SkPoint[], 694 static void RotTrans_pts(const SkMatrix&, SkPoint dst[], const SkPoint[],
691 int count); 695 int count);
692 static void Persp_pts(const SkMatrix&, SkPoint dst[], const SkPoint[], int); 696 static void Persp_pts(const SkMatrix&, SkPoint dst[], const SkPoint[], int);
693 697
694 static const MapPtsProc gMapPtsProcs[]; 698 static const MapPtsProc gMapPtsProcs[];
695 699
696 friend class SkPerspIter; 700 friend class SkPerspIter;
697 }; 701 };
698 702
699 #endif 703 #endif
OLDNEW
« no previous file with comments | « no previous file | include/core/SkPath.h » ('j') | include/core/SkPath.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698