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

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

Issue 1135133002: Fix a heap overflow in CJBig2_Context::parseSymbolDict (Closed) Base URL: https://pdfium.googlesource.com/pdfium@2357
Patch Set: Created 5 years, 7 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
« no previous file with comments | « core/src/fxcodec/jbig2/JBig2_ArithQe.h ('k') | 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 "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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 { 0x0085, 40, 37, 0 }, 54 { 0x0085, 40, 37, 0 },
55 { 0x0049, 41, 38, 0 }, 55 { 0x0049, 41, 38, 0 },
56 { 0x0025, 42, 39, 0 }, 56 { 0x0025, 42, 39, 0 },
57 { 0x0015, 43, 40, 0 }, 57 { 0x0015, 43, 40, 0 },
58 { 0x0009, 44, 41, 0 }, 58 { 0x0009, 44, 41, 0 },
59 { 0x0005, 45, 42, 0 }, 59 { 0x0005, 45, 42, 0 },
60 { 0x0001, 45, 43, 0 }, 60 { 0x0001, 45, 43, 0 },
61 { 0x5601, 46, 46, 0 } 61 { 0x5601, 46, 46, 0 }
62 }; 62 };
63 63
64 extern const unsigned int JBIG2_QE_NUM = sizeof(QeTable) / sizeof(JBig2ArithQe);
65
64 CJBig2_Image *CJBig2_GRDProc::decode_Arith(CJBig2_ArithDecoder *pArithDecoder, J Big2ArithCtx *gbContext) 66 CJBig2_Image *CJBig2_GRDProc::decode_Arith(CJBig2_ArithDecoder *pArithDecoder, J Big2ArithCtx *gbContext)
65 { 67 {
66 if (GBW == 0 || GBH == 0) { 68 if (GBW == 0 || GBH == 0) {
67 CJBig2_Image* pImage; 69 CJBig2_Image* pImage;
68 JBIG2_ALLOC(pImage, CJBig2_Image(GBW, GBH)); 70 JBIG2_ALLOC(pImage, CJBig2_Image(GBW, GBH));
69 return pImage; 71 return pImage;
70 } 72 }
71 if(GBTEMPLATE == 0) { 73 if(GBTEMPLATE == 0) {
72 if((GBAT[0] == 3) && (GBAT[1] == (signed char) - 1) 74 if((GBAT[0] == 3) && (GBAT[1] == (signed char) - 1)
73 && (GBAT[2] == (signed char) - 3) && (GBAT[3] == (signed char) - 1) 75 && (GBAT[2] == (signed char) - 3) && (GBAT[3] == (signed char) - 1)
(...skipping 4258 matching lines...) Expand 10 before | Expand all | Expand 10 after
4332 } 4334 }
4333 if(pPause && pPause->NeedToPauseNow()) { 4335 if(pPause && pPause->NeedToPauseNow()) {
4334 m_loopIndex++; 4336 m_loopIndex++;
4335 m_ProssiveStatus = FXCODEC_STATUS_DECODE_TOBECONTINUE; 4337 m_ProssiveStatus = FXCODEC_STATUS_DECODE_TOBECONTINUE;
4336 return FXCODEC_STATUS_DECODE_TOBECONTINUE; 4338 return FXCODEC_STATUS_DECODE_TOBECONTINUE;
4337 } 4339 }
4338 } 4340 }
4339 m_ProssiveStatus = FXCODEC_STATUS_DECODE_FINISH; 4341 m_ProssiveStatus = FXCODEC_STATUS_DECODE_FINISH;
4340 return FXCODEC_STATUS_DECODE_FINISH; 4342 return FXCODEC_STATUS_DECODE_FINISH;
4341 } 4343 }
OLDNEW
« no previous file with comments | « core/src/fxcodec/jbig2/JBig2_ArithQe.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698