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_docpagedata.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_docpagedata.cpp')
-rw-r--r-- | core/fpdfapi/page/cpdf_docpagedata.cpp | 26 |
1 files changed, 8 insertions, 18 deletions
diff --git a/core/fpdfapi/page/cpdf_docpagedata.cpp b/core/fpdfapi/page/cpdf_docpagedata.cpp index c4dc050215..7c45a04af1 100644 --- a/core/fpdfapi/page/cpdf_docpagedata.cpp +++ b/core/fpdfapi/page/cpdf_docpagedata.cpp @@ -393,31 +393,21 @@ void CPDF_DocPageData::ReleasePattern(const CPDF_Object* pPatternObj) { pPattern->clear(); } -CPDF_Image* CPDF_DocPageData::GetImage(CPDF_Object* pImageStream) { - if (!pImageStream) - return nullptr; - - ASSERT(!pImageStream->IsInline()); - const uint32_t dwObjNum = pImageStream->GetObjNum(); - auto it = m_ImageMap.find(dwObjNum); +CPDF_Image* CPDF_DocPageData::GetImage(uint32_t dwStreamObjNum) { + ASSERT(dwStreamObjNum); + auto it = m_ImageMap.find(dwStreamObjNum); if (it != m_ImageMap.end()) return it->second->AddRef(); CPDF_CountedImage* pCountedImage = - new CPDF_CountedImage(new CPDF_Image(m_pPDFDoc, dwObjNum)); - m_ImageMap[dwObjNum] = pCountedImage; + new CPDF_CountedImage(new CPDF_Image(m_pPDFDoc, dwStreamObjNum)); + m_ImageMap[dwStreamObjNum] = pCountedImage; return pCountedImage->AddRef(); } -void CPDF_DocPageData::ReleaseImage(const CPDF_Object* pImageStream) { - if (!pImageStream) - return; - - uint32_t dwObjNum = pImageStream->GetObjNum(); - if (!dwObjNum) - return; - - auto it = m_ImageMap.find(dwObjNum); +void CPDF_DocPageData::ReleaseImage(uint32_t dwStreamObjNum) { + ASSERT(dwStreamObjNum); + auto it = m_ImageMap.find(dwStreamObjNum); if (it == m_ImageMap.end()) return; |