summaryrefslogtreecommitdiff
path: root/core/fxcodec/codec/ccodec_gifmodule.cpp
diff options
context:
space:
mode:
authorNicolas Pena <npm@chromium.org>2017-05-23 19:07:25 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-05-23 23:30:17 +0000
commit6f3593c5cdf62915fc086448312671ce1fce5291 (patch)
tree14bb1e913dad31e80db2ae588f531603e93bea4b /core/fxcodec/codec/ccodec_gifmodule.cpp
parenta861a7b4696e0ffd4be73c63d7ed3611e461b1c1 (diff)
downloadpdfium-6f3593c5cdf62915fc086448312671ce1fce5291.tar.xz
Remove longjmp from the Gif module
The Gif module is only using the longjmp as a way to catch errors, so this CL makes it use GifDecodeStatus::Error instead. Change-Id: I9c97e63ed851d2a80e38f1d2cd9e8f297d608cb2 Reviewed-on: https://pdfium-review.googlesource.com/5850 Commit-Queue: Nicolás Peña <npm@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'core/fxcodec/codec/ccodec_gifmodule.cpp')
-rw-r--r--core/fxcodec/codec/ccodec_gifmodule.cpp42
1 files changed, 16 insertions, 26 deletions
diff --git a/core/fxcodec/codec/ccodec_gifmodule.cpp b/core/fxcodec/codec/ccodec_gifmodule.cpp
index 438f019ee9..11980ee7a5 100644
--- a/core/fxcodec/codec/ccodec_gifmodule.cpp
+++ b/core/fxcodec/codec/ccodec_gifmodule.cpp
@@ -30,9 +30,6 @@ GifDecodeStatus CCodec_GifModule::ReadHeader(CGifContext* context,
void** pal_pp,
int* bg_index,
CFX_DIBAttribute* pAttribute) {
- if (setjmp(context->jmpbuf))
- return GifDecodeStatus::Error;
-
GifDecodeStatus ret = gif_read_header(context);
if (ret != GifDecodeStatus::Success)
return ret;
@@ -48,9 +45,6 @@ GifDecodeStatus CCodec_GifModule::ReadHeader(CGifContext* context,
GifDecodeStatus CCodec_GifModule::LoadFrameInfo(CGifContext* context,
int* frame_num) {
- if (setjmp(context->jmpbuf))
- return GifDecodeStatus::Error;
-
GifDecodeStatus ret = gif_get_frame(context);
if (ret != GifDecodeStatus::Success)
return ret;
@@ -62,28 +56,24 @@ GifDecodeStatus CCodec_GifModule::LoadFrameInfo(CGifContext* context,
GifDecodeStatus CCodec_GifModule::LoadFrame(CGifContext* context,
int frame_num,
CFX_DIBAttribute* pAttribute) {
- if (setjmp(context->jmpbuf))
- return GifDecodeStatus::Error;
-
GifDecodeStatus ret = gif_load_frame(context, frame_num);
- if (ret == GifDecodeStatus::Success) {
- if (pAttribute) {
- pAttribute->m_nGifLeft = context->m_Images[frame_num]->m_ImageInfo.left;
- pAttribute->m_nGifTop = context->m_Images[frame_num]->m_ImageInfo.top;
- pAttribute->m_fAspectRatio = context->pixel_aspect;
- const uint8_t* buf =
- reinterpret_cast<const uint8_t*>(context->cmt_data.GetBuffer(0));
- uint32_t len = context->cmt_data.GetLength();
- if (len > 21) {
- uint8_t size = *buf++;
- if (size != 0)
- pAttribute->m_strAuthor = CFX_ByteString(buf, size);
- else
- pAttribute->m_strAuthor.clear();
- }
- }
+ if (ret != GifDecodeStatus::Success || !pAttribute)
+ return ret;
+
+ pAttribute->m_nGifLeft = context->m_Images[frame_num]->m_ImageInfo.left;
+ pAttribute->m_nGifTop = context->m_Images[frame_num]->m_ImageInfo.top;
+ pAttribute->m_fAspectRatio = context->pixel_aspect;
+ const uint8_t* buf =
+ reinterpret_cast<const uint8_t*>(context->cmt_data.GetBuffer(0));
+ uint32_t len = context->cmt_data.GetLength();
+ if (len > 21) {
+ uint8_t size = *buf++;
+ if (size != 0)
+ pAttribute->m_strAuthor = CFX_ByteString(buf, size);
+ else
+ pAttribute->m_strAuthor.clear();
}
- return ret;
+ return GifDecodeStatus::Success;
}
uint32_t CCodec_GifModule::GetAvailInput(CGifContext* context,