summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Weintraub <asweintraub@google.com>2017-05-10 13:19:52 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-05-10 18:06:38 +0000
commit21f88ffe5c2c9fc7af9a7bcc4a654ad1008ab17e (patch)
tree2dde962565ecbff0af2c3a8fe4143d80609170b4
parent3e2d1ac83977b0fc150b4b25532f4e82048dc3e1 (diff)
downloadpdfium-chromium/3096.tar.xz
Fix FPDFImageObj_LoadJpegFile(Inline) to allow NULL to be passed in for pages, as the documentation explicitly allows this.chromium/3096
Bug:pdfium:710 Change-Id: I0535b45c16ae7a53609da3b09ff7d427c52567b5 Reviewed-on: https://pdfium-review.googlesource.com/5270 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
-rw-r--r--fpdfsdk/fpdfeditimg.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/fpdfsdk/fpdfeditimg.cpp b/fpdfsdk/fpdfeditimg.cpp
index 1207ecf06d..6a300c9e62 100644
--- a/fpdfsdk/fpdfeditimg.cpp
+++ b/fpdfsdk/fpdfeditimg.cpp
@@ -20,16 +20,19 @@ bool LoadJpegHelper(FPDF_PAGE* pages,
FPDF_PAGEOBJECT image_object,
FPDF_FILEACCESS* fileAccess,
bool inlineJpeg) {
- if (!image_object || !fileAccess || !pages)
+ if (!image_object || !fileAccess)
return false;
CFX_RetainPtr<IFX_SeekableReadStream> pFile =
MakeSeekableReadStream(fileAccess);
CPDF_ImageObject* pImgObj = reinterpret_cast<CPDF_ImageObject*>(image_object);
- for (int index = 0; index < nCount; index++) {
- CPDF_Page* pPage = CPDFPageFromFPDFPage(pages[index]);
- if (pPage)
- pImgObj->GetImage()->ResetCache(pPage, nullptr);
+
+ if (pages) {
+ for (int index = 0; index < nCount; index++) {
+ CPDF_Page* pPage = CPDFPageFromFPDFPage(pages[index]);
+ if (pPage)
+ pImgObj->GetImage()->ResetCache(pPage, nullptr);
+ }
}
if (inlineJpeg)