Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(578)

Side by Side Diff: core/src/fxcodec/codec/fx_codec_jpeg.cpp

Issue 1471913005: Merge to M47: Add a missing setjmp() to CCodec_JpegDecoder::v_GetNextLine(). (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@2526
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include <setjmp.h> 7 #include <setjmp.h>
8 8
9 #include "../../../include/fxcodec/fx_codec.h" 9 #include "../../../include/fxcodec/fx_codec.h"
10 #include "../../../include/fxcrt/fx_safe_types.h" 10 #include "../../../include/fxcrt/fx_safe_types.h"
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 FXSYS_assert(FALSE); 495 FXSYS_assert(FALSE);
496 return FALSE; 496 return FALSE;
497 } 497 }
498 m_bStarted = TRUE; 498 m_bStarted = TRUE;
499 return TRUE; 499 return TRUE;
500 } 500 }
501 uint8_t* CCodec_JpegDecoder::v_GetNextLine() { 501 uint8_t* CCodec_JpegDecoder::v_GetNextLine() {
502 if (m_pExtProvider) { 502 if (m_pExtProvider) {
503 return m_pExtProvider->GetNextLine(m_pExtContext); 503 return m_pExtProvider->GetNextLine(m_pExtContext);
504 } 504 }
505
506 if (setjmp(m_JmpBuf) == -1)
507 return nullptr;
508
505 int nlines = jpeg_read_scanlines(&cinfo, &m_pScanlineBuf, 1); 509 int nlines = jpeg_read_scanlines(&cinfo, &m_pScanlineBuf, 1);
506 if (nlines < 1) { 510 if (nlines < 1) {
507 return NULL; 511 return nullptr;
508 } 512 }
509 return m_pScanlineBuf; 513 return m_pScanlineBuf;
510 } 514 }
511 FX_DWORD CCodec_JpegDecoder::GetSrcOffset() { 515 FX_DWORD CCodec_JpegDecoder::GetSrcOffset() {
512 if (m_pExtProvider) { 516 if (m_pExtProvider) {
513 return m_pExtProvider->GetSrcOffset(m_pExtContext); 517 return m_pExtProvider->GetSrcOffset(m_pExtContext);
514 } 518 }
515 return (FX_DWORD)(m_SrcSize - src.bytes_in_buffer); 519 return (FX_DWORD)(m_SrcSize - src.bytes_in_buffer);
516 } 520 }
517 ICodec_ScanlineDecoder* CCodec_JpegModule::CreateDecoder( 521 ICodec_ScanlineDecoder* CCodec_JpegModule::CreateDecoder(
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
709 } 713 }
710 if (avail_buf_ptr != NULL) { 714 if (avail_buf_ptr != NULL) {
711 *avail_buf_ptr = NULL; 715 *avail_buf_ptr = NULL;
712 if (((FXJPEG_Context*)pContext)->m_SrcMgr.bytes_in_buffer > 0) { 716 if (((FXJPEG_Context*)pContext)->m_SrcMgr.bytes_in_buffer > 0) {
713 *avail_buf_ptr = 717 *avail_buf_ptr =
714 (uint8_t*)((FXJPEG_Context*)pContext)->m_SrcMgr.next_input_byte; 718 (uint8_t*)((FXJPEG_Context*)pContext)->m_SrcMgr.next_input_byte;
715 } 719 }
716 } 720 }
717 return (FX_DWORD)((FXJPEG_Context*)pContext)->m_SrcMgr.bytes_in_buffer; 721 return (FX_DWORD)((FXJPEG_Context*)pContext)->m_SrcMgr.bytes_in_buffer;
718 } 722 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698