From 21f88ffe5c2c9fc7af9a7bcc4a654ad1008ab17e Mon Sep 17 00:00:00 2001 From: Andrew Weintraub Date: Wed, 10 May 2017 13:19:52 -0400 Subject: Fix FPDFImageObj_LoadJpegFile(Inline) to allow NULL to be passed in for pages, as the documentation explicitly allows this. Bug:pdfium:710 Change-Id: I0535b45c16ae7a53609da3b09ff7d427c52567b5 Reviewed-on: https://pdfium-review.googlesource.com/5270 Reviewed-by: dsinclair Commit-Queue: dsinclair --- fpdfsdk/fpdfeditimg.cpp | 13 ++++++++----- 1 file 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 pFile = MakeSeekableReadStream(fileAccess); CPDF_ImageObject* pImgObj = reinterpret_cast(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) -- cgit v1.2.3