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

Unified Diff: include/core/SkPathRef.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 side-by-side diff with in-line comments
Download patch
Index: include/core/SkPathRef.h
diff --git a/include/core/SkPathRef.h b/include/core/SkPathRef.h
index d832944ec340a6a04c573aeb029a8ff5c9cc9dfd..178a41a0f5ef7b092393ae06edb558531dd8ca7d 100644
--- a/include/core/SkPathRef.h
+++ b/include/core/SkPathRef.h
@@ -16,6 +16,7 @@
#include "SkTDArray.h"
#include <stddef.h> // ptrdiff_t
+class SkFlattenableReadBuffer;
class SkRBuffer;
class SkWBuffer;
@@ -158,6 +159,16 @@ public:
);
/**
+ * Returns the number of bytes that will be read in CreateFromBuffer()
+ */
+ static uint32_t SizeToRead(SkFlattenableReadBuffer& buffer
+#ifndef DELETE_THIS_CODE_WHEN_SKPS_ARE_REBUILT_AT_V14_AND_ALL_OTHER_INSTANCES_TOO
+ , bool newFormat
+#endif
+ );
+
+
+ /**
* Rollsback a path ref to zero verbs and points with the assumption that the path ref will be
* repopulated with approximately the same number of verbs and points. A new path ref is created
* only if necessary.

Powered by Google App Engine
This is Rietveld 408576698