diff options
author | tsepez <tsepez@chromium.org> | 2016-11-14 15:03:55 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-11-14 15:03:55 -0800 |
commit | 137a344ad02056107e2e01d5d55f5e97d21fa74b (patch) | |
tree | 25bb148e669379d6f7f0d2d737d532db10ce9380 /core/fpdfapi/page/cpdf_streamcontentparser.cpp | |
parent | 88d87c13c25fbd20fd2963e8ff4b383c5d64b5f4 (diff) | |
download | pdfium-137a344ad02056107e2e01d5d55f5e97d21fa74b.tar.xz |
Make CPDF_PageContentGenerator methods take object numbers
This patch fixes a possibility that an owned CPDF_Stream is handed to the
indirect object holder inside RealizeResource(). Its arguments are
changed to take an object number, as is done elsewhere in the code, to
suggest that only indirect objects are acceptable.
BUG=660756
Review-Url: https://codereview.chromium.org/2489423002
Diffstat (limited to 'core/fpdfapi/page/cpdf_streamcontentparser.cpp')
-rw-r--r-- | core/fpdfapi/page/cpdf_streamcontentparser.cpp | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/core/fpdfapi/page/cpdf_streamcontentparser.cpp b/core/fpdfapi/page/cpdf_streamcontentparser.cpp index e7d23c0522..69b2b7e4e3 100644 --- a/core/fpdfapi/page/cpdf_streamcontentparser.cpp +++ b/core/fpdfapi/page/cpdf_streamcontentparser.cpp @@ -825,12 +825,8 @@ CPDF_ImageObject* CPDF_StreamContentParser::AddImage( } CPDF_ImageObject* CPDF_StreamContentParser::AddImage(uint32_t streamObjNum) { - CPDF_Stream* pStream = ToStream(m_pDocument->GetIndirectObject(streamObjNum)); - if (!pStream) - return nullptr; - auto pImageObj = pdfium::MakeUnique<CPDF_ImageObject>(); - pImageObj->SetUnownedImage(m_pDocument->LoadImageF(pStream)); + pImageObj->SetUnownedImage(m_pDocument->LoadImageFromPageData(streamObjNum)); return AddImageObject(std::move(pImageObj)); } @@ -840,7 +836,7 @@ CPDF_ImageObject* CPDF_StreamContentParser::AddImage(CPDF_Image* pImage) { auto pImageObj = pdfium::MakeUnique<CPDF_ImageObject>(); pImageObj->SetUnownedImage( - m_pDocument->GetPageData()->GetImage(pImage->GetStream())); + m_pDocument->GetPageData()->GetImage(pImage->GetStream()->GetObjNum())); return AddImageObject(std::move(pImageObj)); } |