summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-09-17 23:44:46 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-09-17 23:44:46 +0000
commit0127cdaeff86335e9a2954706bdf0edee79e7975 (patch)
treed4bb42ba9ac251964abf2fe2be0bd8bb5b464c00
parente063301440f00207c5d72a01883777adb1686455 (diff)
downloadpdfium-0127cdaeff86335e9a2954706bdf0edee79e7975.tar.xz
Check for empty streams earlier in CPDF_StreamAcc::LoadAllData().
Change-Id: I91c8d7d837e4c2104d56d725c16a28d49399aaca Reviewed-on: https://pdfium-review.googlesource.com/42592 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
-rw-r--r--core/fpdfapi/parser/cpdf_stream_acc.cpp9
1 files 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()) {