Fix member destruction order in CPDF_StreamAcc.
Destroy the span pointing into a CPDF_Stream first, instead of the other
way around. This avoids a ProbeForLowSeverityLifetimeIssue() failure.
Bug: chromium:1361849
Change-Id: I72c3bde70d3c7ace9fa5918e7908dab75c6582d4
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/97776
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/core/fpdfapi/parser/cpdf_stream_acc.h b/core/fpdfapi/parser/cpdf_stream_acc.h
index 3314a0e..44b77c1 100644
--- a/core/fpdfapi/parser/cpdf_stream_acc.h
+++ b/core/fpdfapi/parser/cpdf_stream_acc.h
@@ -67,10 +67,11 @@
bool is_owned() const { return m_Data.index() == 1; }
- absl::variant<pdfium::span<const uint8_t>, OwnedData> m_Data;
ByteString m_ImageDecoder;
RetainPtr<const CPDF_Dictionary> m_pImageParam;
+ // Needs to outlive `m_Data` when the data is not owned.
RetainPtr<const CPDF_Stream> const m_pStream;
+ absl::variant<pdfium::span<const uint8_t>, OwnedData> m_Data;
};
#endif // CORE_FPDFAPI_PARSER_CPDF_STREAM_ACC_H_