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

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: 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
« no previous file with comments | « no previous file | include/core/SkPath.h » ('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 /* 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 542 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 written, whether or not buffer is null 561 // return the number of bytes written, whether or not buffer is null
562 uint32_t writeToMemory(void* buffer) const; 562 uint32_t writeToMemory(void* buffer) const;
563 // return the number of bytes read 563 // return the number of bytes read
reed1 2013/10/25 14:42:46 // Please document what 'length' is used for.
sugoi1 2013/10/25 14:59:02 Done.
564 uint32_t readFromMemory(const void* buffer); 564 uint32_t readFromMemory(const void* buffer, uint32_t length);
565 565
566 SkDEVCODE(void dump() const;) 566 SkDEVCODE(void dump() const;)
567 SkDEVCODE(void toString(SkString*) const;) 567 SkDEVCODE(void toString(SkString*) const;)
568 568
569 /** 569 /**
570 * Calculates the maximum stretching factor of the matrix. If the matrix has 570 * Calculates the maximum stretching factor of the matrix. If the matrix has
571 * perspective -1 is returned. 571 * perspective -1 is returned.
572 * 572 *
573 * @return maximum strecthing factor 573 * @return maximum strecthing factor
574 */ 574 */
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
690 static void RotTrans_pts(const SkMatrix&, SkPoint dst[], const SkPoint[], 690 static void RotTrans_pts(const SkMatrix&, SkPoint dst[], const SkPoint[],
691 int count); 691 int count);
692 static void Persp_pts(const SkMatrix&, SkPoint dst[], const SkPoint[], int); 692 static void Persp_pts(const SkMatrix&, SkPoint dst[], const SkPoint[], int);
693 693
694 static const MapPtsProc gMapPtsProcs[]; 694 static const MapPtsProc gMapPtsProcs[];
695 695
696 friend class SkPerspIter; 696 friend class SkPerspIter;
697 }; 697 };
698 698
699 #endif 699 #endif
OLDNEW
« no previous file with comments | « no previous file | include/core/SkPath.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698