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

Unified Diff: include/core/SkPixelRef.h

Issue 92793002: Fixed bad bitmap size crashes (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Changed getSize name to getAllocatedSizeInBytes Created 7 years 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/SkPixelRef.h
diff --git a/include/core/SkPixelRef.h b/include/core/SkPixelRef.h
index d90e58719bb0b87f5bd3b5ce9b0dc4c90e056259..4c564e40c2b741b713e1d9a80c4fe5eb5cf78e56 100644
--- a/include/core/SkPixelRef.h
+++ b/include/core/SkPixelRef.h
@@ -257,6 +257,16 @@ protected:
// default impl returns NULL.
virtual SkData* onRefEncodedData();
+ /**
+ * Returns the size (in bytes) of the internally allocated memory.
+ * This should be implemented in all serializable SkPixelRef derived classes.
+ * SkBitmap::fPixelRefOffset + SkBitmap::getSafeSize() should never overflow this value,
+ * otherwise the rendering code may attempt to read memory out of bounds.
+ *
+ * @return default impl returns 0.
+ */
+ virtual size_t getAllocatedSizeInBytes() const;
+
/** Return the mutex associated with this pixelref. This value is assigned
in the constructor, and cannot change during the lifetime of the object.
*/

Powered by Google App Engine
This is Rietveld 408576698