summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authordsinclair <dsinclair@chromium.org>2016-06-20 09:09:56 -0700
committerCommit bot <commit-bot@chromium.org>2016-06-20 09:09:56 -0700
commit54d027dbbff8a0270531855082e4f61cb457c173 (patch)
tree3c3759aa29b5aef195294d119a99f889b35a456c /core
parent7d554c9dabeb7474dbdabbbf7d01a4abaa7f65a0 (diff)
downloadpdfium-54d027dbbff8a0270531855082e4f61cb457c173.tar.xz
Fixup LoadImageInfo type checking.
The ::DetectImageType method does more then just detecting the image type, it also sets up various needed structures to handle the decoding. Instead of skipping the ::DetectImageType call this CL changes the code to return early if the image check fails. This should allow us to stop working on images which do not match the required data format. BUG=chromium:621094 Review-Url: https://codereview.chromium.org/2085493002
Diffstat (limited to 'core')
-rw-r--r--core/fxcodec/codec/fx_codec_progress.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/core/fxcodec/codec/fx_codec_progress.cpp b/core/fxcodec/codec/fx_codec_progress.cpp
index 04ca7b26c2..3551fc272d 100644
--- a/core/fxcodec/codec/fx_codec_progress.cpp
+++ b/core/fxcodec/codec/fx_codec_progress.cpp
@@ -1322,12 +1322,18 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::LoadImageInfo(
m_startX = m_startY = 0;
m_sizeX = m_sizeY = 0;
m_SrcPassNumber = 0;
- if (bSkipImageTypeCheck || (imageType != FXCODEC_IMAGE_UNKNOWN &&
- DetectImageType(imageType, pAttribute))) {
+ if (imageType != FXCODEC_IMAGE_UNKNOWN &&
+ DetectImageType(imageType, pAttribute)) {
m_imagType = imageType;
m_status = FXCODEC_STATUS_FRAME_READY;
return m_status;
}
+ // If we got here then the image data does not match the requested decoder.
+ // If we're skipping the type check then bail out at this point and return
+ // the failed status.
+ if (bSkipImageTypeCheck)
+ return m_status;
+
for (int type = FXCODEC_IMAGE_BMP; type < FXCODEC_IMAGE_MAX; type++) {
if (DetectImageType((FXCODEC_IMAGE_TYPE)type, pAttribute)) {
m_imagType = (FXCODEC_IMAGE_TYPE)type;