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

Side by Side Diff: include/core/SkPath.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
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 SkPath_DEFINED 10 #ifndef SkPath_DEFINED
11 #define SkPath_DEFINED 11 #define SkPath_DEFINED
12 12
13 #include "SkInstCnt.h" 13 #include "SkInstCnt.h"
14 #include "SkMatrix.h" 14 #include "SkMatrix.h"
15 #include "SkPathRef.h" 15 #include "SkPathRef.h"
16 #include "SkTDArray.h" 16 #include "SkTDArray.h"
17 #include "SkRefCnt.h" 17 #include "SkRefCnt.h"
18 18
19 #ifdef SK_BUILD_FOR_ANDROID 19 #ifdef SK_BUILD_FOR_ANDROID
20 #define GEN_ID_INC fGenerationID++ 20 #define GEN_ID_INC fGenerationID++
21 #define GEN_ID_PTR_INC(ptr) (ptr)->fGenerationID++ 21 #define GEN_ID_PTR_INC(ptr) (ptr)->fGenerationID++
22 #else 22 #else
23 #define GEN_ID_INC 23 #define GEN_ID_INC
24 #define GEN_ID_PTR_INC(ptr) 24 #define GEN_ID_PTR_INC(ptr)
25 #endif 25 #endif
26 26
27 class SkReader32; 27 class SkReader32;
28 class SkWriter32; 28 class SkWriter32;
29 class SkAutoPathBoundsUpdate; 29 class SkAutoPathBoundsUpdate;
30 class SkFlattenableReadBuffer;
30 class SkString; 31 class SkString;
31 class SkRRect; 32 class SkRRect;
32 33
33 /** \class SkPath 34 /** \class SkPath
34 35
35 The SkPath class encapsulates compound (multiple contour) geometric paths 36 The SkPath class encapsulates compound (multiple contour) geometric paths
36 consisting of straight line segments, quadratic curves, and cubic curves. 37 consisting of straight line segments, quadratic curves, and cubic curves.
37 */ 38 */
38 class SK_API SkPath { 39 class SK_API SkPath {
39 public: 40 public:
(...skipping 863 matching lines...) Expand 10 before | Expand all | Expand 10 after
903 /** 904 /**
904 * Returns true if the point { x, y } is contained by the path, taking into 905 * Returns true if the point { x, y } is contained by the path, taking into
905 * account the FillType. 906 * account the FillType.
906 */ 907 */
907 bool contains(SkScalar x, SkScalar y) const; 908 bool contains(SkScalar x, SkScalar y) const;
908 909
909 void dump(bool forceClose, const char title[] = NULL) const; 910 void dump(bool forceClose, const char title[] = NULL) const;
910 void dump() const; 911 void dump() const;
911 912
912 /** 913 /**
914 * Returns the number of bytes of the current object's flattened representa tion.
915 */
916 uint32_t sizeInMemory() const;
917 /**
918 * Returns the number of bytes to read.
919 */
920 static uint32_t SizeToRead(SkFlattenableReadBuffer& buffer);
reed1 2013/10/24 20:51:19 :( Do we really need to teach SkPath about readbuf
921 /**
913 * Write the region to the buffer, and return the number of bytes written. 922 * Write the region to the buffer, and return the number of bytes written.
914 * If buffer is NULL, it still returns the number of bytes. 923 * If buffer is NULL, it still returns the number of bytes.
915 */ 924 */
916 uint32_t writeToMemory(void* buffer) const; 925 uint32_t writeToMemory(void* buffer) const;
917 /** 926 /**
918 * Initialized the region from the buffer, returning the number 927 * Initialized the region from the buffer, returning the number
919 * of bytes actually read. 928 * of bytes actually read.
920 */ 929 */
921 uint32_t readFromMemory(const void* buffer); 930 uint32_t readFromMemory(const void* buffer);
922 931
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
1016 #ifndef DELETE_THIS_CODE_WHEN_SKPS_ARE_REBUILT_AT_V14_AND_ALL_OTHER_INSTANCES_TO O 1025 #ifndef DELETE_THIS_CODE_WHEN_SKPS_ARE_REBUILT_AT_V14_AND_ALL_OTHER_INSTANCES_TO O
1017 friend class SkPathRef; // just for SerializationOffsets 1026 friend class SkPathRef; // just for SerializationOffsets
1018 #endif 1027 #endif
1019 friend class SkAutoPathBoundsUpdate; 1028 friend class SkAutoPathBoundsUpdate;
1020 friend class SkAutoDisableOvalCheck; 1029 friend class SkAutoDisableOvalCheck;
1021 friend class SkAutoDisableDirectionCheck; 1030 friend class SkAutoDisableDirectionCheck;
1022 friend class SkBench_AddPathTest; // perf test pathTo/reversePathTo 1031 friend class SkBench_AddPathTest; // perf test pathTo/reversePathTo
1023 }; 1032 };
1024 1033
1025 #endif 1034 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698