diff options
author | Mike Reed <reed@google.com> | 2018-02-01 14:45:50 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-02-01 20:09:58 +0000 |
commit | 40d8297ca873faa5454a50b64b4ae7651fd84375 (patch) | |
tree | 30ec6ea04b68b4f16520c76a8e25adf293f2fc02 /tests/PictureTest.cpp | |
parent | 7a13705e03b7ba3d7f858f2e3081c353c7be8bd4 (diff) |
detect truncated pict streams
Bug: skia:7565
Change-Id: I203797fb8d4ced8d3fcb13de71feb5f4487c9515
Reviewed-on: https://skia-review.googlesource.com/102661
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Mike Klein <mtklein@chromium.org>
Diffstat (limited to 'tests/PictureTest.cpp')
-rw-r--r-- | tests/PictureTest.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/PictureTest.cpp b/tests/PictureTest.cpp index 7acce49943..425b25a153 100644 --- a/tests/PictureTest.cpp +++ b/tests/PictureTest.cpp @@ -853,3 +853,17 @@ DEF_TEST(Placeholder, r) { sk_sp<SkPicture> pic = recorder.finishRecordingAsPicture(); REPORTER_ASSERT(r, pic->approximateOpCount() == 2); } + +DEF_TEST(Picture_empty_serial, reporter) { + SkPictureRecorder rec; + (void)rec.beginRecording(10, 10); + auto pic = rec.finishRecordingAsPicture(); + REPORTER_ASSERT(reporter, pic); + + auto data = pic->serialize(); + REPORTER_ASSERT(reporter, data); + + auto pic2 = SkPicture::MakeFromData(data->data(), data->size()); + REPORTER_ASSERT(reporter, pic2); +} + |