| commit | f5406e512907cd8efbc67841bb0dfc51c5105f51 | [log] [tgz] |
|---|---|---|
| author | Lei Zhang <thestig@chromium.org> | Mon Sep 12 18:37:47 2022 +0000 |
| committer | Pdfium LUCI CQ <pdfium-scoped@luci-project-accounts.iam.gserviceaccount.com> | Mon Sep 12 18:37:47 2022 +0000 |
| tree | 625db31cd7891f0bdc0e1d018eaf18fc4c4dd225 | |
| parent | f979a14da581715c776beb9cb981a7f29eb15c7a [diff] |
Add a regression test case to StreamAccTest. Make sure the issue https://pdfium-review.googlesource.com/97776 fixed stays fixed. Bug: chromium:1361849 Change-Id: Ifc446b178ce5619bd7c241953834e3406b2430a4 Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/97870 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/core/fpdfapi/parser/cpdf_stream_acc_unittest.cpp b/core/fpdfapi/parser/cpdf_stream_acc_unittest.cpp index 4cbe9fd..f2dd458 100644 --- a/core/fpdfapi/parser/cpdf_stream_acc_unittest.cpp +++ b/core/fpdfapi/parser/cpdf_stream_acc_unittest.cpp
@@ -19,3 +19,15 @@ stream_acc->LoadAllDataRaw(); EXPECT_TRUE(stream_acc->GetSpan().empty()); } + +// Regression test for crbug.com/1361849. Should not trigger +// ProbeForLowSeverityLifetimeIssue() failure. +TEST(StreamAccTest, DataStreamLifeTime) { + constexpr uint8_t kData[] = {'a', 'b', 'c'}; + auto stream = pdfium::MakeRetain<CPDF_Stream>(); + stream->SetData(kData); + auto stream_acc = pdfium::MakeRetain<CPDF_StreamAcc>(stream.Get()); + stream_acc->LoadAllDataRaw(); + stream.Reset(); + EXPECT_EQ(pdfium::make_span(kData), stream_acc->GetSpan()); +}