Ensure that SkMemoryStream does not crash dereferencing fData.
SkMemoryStream attempts to dereference fData in multiple places.
Instead of allowing it to be NULL, resulting in a crash, set it
to SkData::NewEmpty().
Add a test for SkStream that will crash when its SkData is set to NULL.
Review URL: https://codereview.appspot.com/7061059
git-svn-id: http://skia.googlecode.com/svn/trunk@7111 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/include/core/SkStream.h b/include/core/SkStream.h
index 8f0548e..7ec3117 100644
--- a/include/core/SkStream.h
+++ b/include/core/SkStream.h
@@ -188,7 +188,13 @@
/** if copyData is true, the stream makes a private copy of the data
*/
SkMemoryStream(const void* data, size_t length, bool copyData = false);
- SkMemoryStream(SkData *data);
+
+ /**
+ * Use the specified data as the memory for this stream. The stream will
+ * call ref() on the data (assuming it is not null).
+ */
+ SkMemoryStream(SkData*);
+
virtual ~SkMemoryStream();
/** Resets the stream to the specified data and length,