summaryrefslogtreecommitdiff
path: root/core/fxcodec/codec/fx_codec_progress.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/fxcodec/codec/fx_codec_progress.cpp')
-rw-r--r--core/fxcodec/codec/fx_codec_progress.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/core/fxcodec/codec/fx_codec_progress.cpp b/core/fxcodec/codec/fx_codec_progress.cpp
index c9436186ab..c3005bca95 100644
--- a/core/fxcodec/codec/fx_codec_progress.cpp
+++ b/core/fxcodec/codec/fx_codec_progress.cpp
@@ -1105,6 +1105,14 @@ bool CCodec_ProgressiveDecoder::DetectImageType(FXCODEC_IMAGE_TYPE imageType,
}
m_offSet += size;
pJpegModule->Input(m_pJpegContext.get(), m_pSrcBuf, size);
+ // Setting jump marker before calling ReadHeader, since a longjmp to
+ // the marker indicates a fatal error.
+ if (setjmp(*m_pJpegContext->GetJumpMark()) == -1) {
+ m_pJpegContext.reset();
+ m_status = FXCODEC_STATUS_ERR_FORMAT;
+ return false;
+ }
+
int32_t readResult =
pJpegModule->ReadHeader(m_pJpegContext.get(), &m_SrcWidth,
&m_SrcHeight, &m_SrcComponents, pAttribute);