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

Side by Side Diff: core/src/fxcodec/jbig2/JBig2_GeneralDecoder.cpp

Issue 1305033006: Guard against null image data in CJBig2_GRRDProc. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@b514891_clean_aaa_cobject_rm2
Patch Set: belt and suspenders, no goto Created 5 years, 3 months 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
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 "JBig2_GeneralDecoder.h" 7 #include "JBig2_GeneralDecoder.h"
8 #include "JBig2_ArithDecoder.h" 8 #include "JBig2_ArithDecoder.h"
9 #include "JBig2_ArithIntDecoder.h" 9 #include "JBig2_ArithIntDecoder.h"
10 #include "JBig2_HuffmanDecoder.h" 10 #include "JBig2_HuffmanDecoder.h"
(...skipping 701 matching lines...) Expand 10 before | Expand all | Expand 10 after
712 h - GRREFERENCEDY + 1)) & 712 h - GRREFERENCEDY + 1)) &
713 0x07; 713 0x07;
714 } 714 }
715 } 715 }
716 } 716 }
717 return GRREG; 717 return GRREG;
718 } 718 }
719 CJBig2_Image* CJBig2_GRRDProc::decode_Template0_opt( 719 CJBig2_Image* CJBig2_GRRDProc::decode_Template0_opt(
720 CJBig2_ArithDecoder* pArithDecoder, 720 CJBig2_ArithDecoder* pArithDecoder,
721 JBig2ArithCtx* grContext) { 721 JBig2ArithCtx* grContext) {
722 if (!GRREFERENCE->m_pData)
723 return nullptr;
724
722 FX_BOOL LTP, SLTP, bVal; 725 FX_BOOL LTP, SLTP, bVal;
723 FX_DWORD CONTEXT; 726 FX_DWORD CONTEXT;
724 FX_DWORD line1, line1_r, line2_r, line3_r; 727 FX_DWORD line1, line1_r, line2_r, line3_r;
725 uint8_t *pLine, *pLineR, cVal; 728 uint8_t *pLine, *pLineR, cVal;
726 intptr_t nStride, nStrideR, nOffset; 729 intptr_t nStride, nStrideR, nOffset;
727 int32_t k, nBits; 730 int32_t k, nBits;
728 int32_t GRWR, GRHR; 731 int32_t GRWR, GRHR;
729 int32_t GRW, GRH; 732 int32_t GRW, GRH;
730 GRW = (int32_t)CJBig2_GRRDProc::GRW; 733 GRW = (int32_t)CJBig2_GRRDProc::GRW;
731 GRH = (int32_t)CJBig2_GRRDProc::GRH; 734 GRH = (int32_t)CJBig2_GRRDProc::GRH;
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
946 h - GRREFERENCEDY + 1)) & 949 h - GRREFERENCEDY + 1)) &
947 0x03; 950 0x03;
948 } 951 }
949 } 952 }
950 } 953 }
951 return GRREG; 954 return GRREG;
952 } 955 }
953 CJBig2_Image* CJBig2_GRRDProc::decode_Template1_opt( 956 CJBig2_Image* CJBig2_GRRDProc::decode_Template1_opt(
954 CJBig2_ArithDecoder* pArithDecoder, 957 CJBig2_ArithDecoder* pArithDecoder,
955 JBig2ArithCtx* grContext) { 958 JBig2ArithCtx* grContext) {
959 if (!GRREFERENCE->m_pData)
960 return nullptr;
961
956 FX_BOOL LTP, SLTP, bVal; 962 FX_BOOL LTP, SLTP, bVal;
957 FX_DWORD CONTEXT; 963 FX_DWORD CONTEXT;
958 FX_DWORD line1, line1_r, line2_r, line3_r; 964 FX_DWORD line1, line1_r, line2_r, line3_r;
959 uint8_t *pLine, *pLineR, cVal; 965 uint8_t *pLine, *pLineR, cVal;
960 intptr_t nStride, nStrideR, nOffset; 966 intptr_t nStride, nStrideR, nOffset;
961 int32_t k, nBits; 967 int32_t k, nBits;
962 int32_t GRWR, GRHR; 968 int32_t GRWR, GRHR;
963 int32_t GRW, GRH; 969 int32_t GRW, GRH;
964 GRW = (int32_t)CJBig2_GRRDProc::GRW; 970 GRW = (int32_t)CJBig2_GRRDProc::GRW;
965 GRH = (int32_t)CJBig2_GRRDProc::GRH; 971 GRH = (int32_t)CJBig2_GRRDProc::GRH;
(...skipping 2249 matching lines...) Expand 10 before | Expand all | Expand 10 after
3215 } 3221 }
3216 if (pPause && pPause->NeedToPauseNow()) { 3222 if (pPause && pPause->NeedToPauseNow()) {
3217 m_loopIndex++; 3223 m_loopIndex++;
3218 m_ProssiveStatus = FXCODEC_STATUS_DECODE_TOBECONTINUE; 3224 m_ProssiveStatus = FXCODEC_STATUS_DECODE_TOBECONTINUE;
3219 return FXCODEC_STATUS_DECODE_TOBECONTINUE; 3225 return FXCODEC_STATUS_DECODE_TOBECONTINUE;
3220 } 3226 }
3221 } 3227 }
3222 m_ProssiveStatus = FXCODEC_STATUS_DECODE_FINISH; 3228 m_ProssiveStatus = FXCODEC_STATUS_DECODE_FINISH;
3223 return FXCODEC_STATUS_DECODE_FINISH; 3229 return FXCODEC_STATUS_DECODE_FINISH;
3224 } 3230 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698