From 0127cdaeff86335e9a2954706bdf0edee79e7975 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Mon, 17 Sep 2018 23:44:46 +0000 Subject: Check for empty streams earlier in CPDF_StreamAcc::LoadAllData(). Change-Id: I91c8d7d837e4c2104d56d725c16a28d49399aaca Reviewed-on: https://pdfium-review.googlesource.com/42592 Commit-Queue: Lei Zhang Reviewed-by: Tom Sepez --- core/fpdfapi/parser/cpdf_stream_acc.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/core/fpdfapi/parser/cpdf_stream_acc.cpp b/core/fpdfapi/parser/cpdf_stream_acc.cpp index 4614dae710..dc6b1806dc 100644 --- a/core/fpdfapi/parser/cpdf_stream_acc.cpp +++ b/core/fpdfapi/parser/cpdf_stream_acc.cpp @@ -27,15 +27,16 @@ void CPDF_StreamAcc::LoadAllData(bool bRawAccess, if (!m_pStream) return; + uint32_t dwSrcSize = m_pStream->GetRawSize(); + if (dwSrcSize == 0) + return; + bool bProcessRawData = bRawAccess || !m_pStream->HasFilter(); if (bProcessRawData && m_pStream->IsMemoryBased()) { - m_dwSize = m_pStream->GetRawSize(); m_pData = m_pStream->GetInMemoryRawData(); + m_dwSize = dwSrcSize; return; } - uint32_t dwSrcSize = m_pStream->GetRawSize(); - if (dwSrcSize == 0) - return; uint8_t* pSrcData; if (m_pStream->IsMemoryBased()) { -- cgit v1.2.3