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

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: Removing SkMatrix's writeToMemory, readFromMemory 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 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
(...skipping 892 matching lines...) Expand 10 before | Expand all | Expand 10 after
903 /** 903 /**
904 * Returns true if the point { x, y } is contained by the path, taking into 904 * Returns true if the point { x, y } is contained by the path, taking into
905 * account the FillType. 905 * account the FillType.
906 */ 906 */
907 bool contains(SkScalar x, SkScalar y) const; 907 bool contains(SkScalar x, SkScalar y) const;
908 908
909 void dump(bool forceClose, const char title[] = NULL) const; 909 void dump(bool forceClose, const char title[] = NULL) const;
910 void dump() const; 910 void dump() const;
911 911
912 /** 912 /**
913 * Write the region to the buffer, and return the number of bytes written. 913 * Write the path to the buffer, and return the number of bytes written.
914 * If buffer is NULL, it still returns the number of bytes. 914 * If buffer is NULL, it still returns the number of bytes.
915 */ 915 */
916 uint32_t writeToMemory(void* buffer) const; 916 uint32_t writeToMemory(void* buffer) const;
917 /** 917 /**
918 * Initialized the region from the buffer, returning the number 918 * Initializes the path from the buffer
919 * of bytes actually read. 919 *
920 * @param buffer Memory to read from
921 * @param length Amount of memory available in the buffer
922 * @return number of bytes read or 0 if there was not enough memory availabl e
920 */ 923 */
921 uint32_t readFromMemory(const void* buffer); 924 uint32_t readFromMemory(const void* buffer, uint32_t length);
922 925
923 #ifdef SK_BUILD_FOR_ANDROID 926 #ifdef SK_BUILD_FOR_ANDROID
924 uint32_t getGenerationID() const; 927 uint32_t getGenerationID() const;
925 const SkPath* getSourcePath() const; 928 const SkPath* getSourcePath() const;
926 void setSourcePath(const SkPath* path); 929 void setSourcePath(const SkPath* path);
927 #endif 930 #endif
928 931
929 SkDEBUGCODE(void validate() const;) 932 SkDEBUGCODE(void validate() const;)
930 933
931 private: 934 private:
(...skipping 84 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 1019 #ifndef DELETE_THIS_CODE_WHEN_SKPS_ARE_REBUILT_AT_V14_AND_ALL_OTHER_INSTANCES_TO O
1017 friend class SkPathRef; // just for SerializationOffsets 1020 friend class SkPathRef; // just for SerializationOffsets
1018 #endif 1021 #endif
1019 friend class SkAutoPathBoundsUpdate; 1022 friend class SkAutoPathBoundsUpdate;
1020 friend class SkAutoDisableOvalCheck; 1023 friend class SkAutoDisableOvalCheck;
1021 friend class SkAutoDisableDirectionCheck; 1024 friend class SkAutoDisableDirectionCheck;
1022 friend class SkBench_AddPathTest; // perf test pathTo/reversePathTo 1025 friend class SkBench_AddPathTest; // perf test pathTo/reversePathTo
1023 }; 1026 };
1024 1027
1025 #endif 1028 #endif
OLDNEW
« no previous file with comments | « include/core/SkMatrix.h ('k') | include/core/SkReader32.h » ('j') | include/core/SkReader32.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698