| OLD | NEW | 
|---|
| 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 "../../../include/fpdfapi/fpdf_parser.h" | 7 #include "../../../include/fpdfapi/fpdf_parser.h" | 
| 8 #include "../../../include/fpdfapi/fpdf_module.h" | 8 #include "../../../include/fpdfapi/fpdf_module.h" | 
| 9 #include "../../../include/fxcodec/fx_codec.h" | 9 #include "../../../include/fxcodec/fx_codec.h" | 
| 10 #include <limits.h> | 10 #include <limits.h> | 
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 225     check *= BitsPerComponent; | 225     check *= BitsPerComponent; | 
| 226     if (check > INT_MAX - 7) { | 226     if (check > INT_MAX - 7) { | 
| 227         return FALSE; | 227         return FALSE; | 
| 228     } | 228     } | 
| 229     return TRUE; | 229     return TRUE; | 
| 230 } | 230 } | 
| 231 ICodec_ScanlineDecoder* FPDFAPI_CreateFlateDecoder(FX_LPCBYTE src_buf, FX_DWORD 
     src_size, int width, int height, | 231 ICodec_ScanlineDecoder* FPDFAPI_CreateFlateDecoder(FX_LPCBYTE src_buf, FX_DWORD 
     src_size, int width, int height, | 
| 232         int nComps, int bpc, const CPDF_Dictionary* pParams) | 232         int nComps, int bpc, const CPDF_Dictionary* pParams) | 
| 233 { | 233 { | 
| 234     int predictor = 0; | 234     int predictor = 0; | 
| 235     FX_BOOL bEarlyChange = TRUE; |  | 
| 236     int Colors = 0, BitsPerComponent = 0, Columns = 0; | 235     int Colors = 0, BitsPerComponent = 0, Columns = 0; | 
| 237     if (pParams) { | 236     if (pParams) { | 
| 238         predictor = ((CPDF_Dictionary*)pParams)->GetInteger(FX_BSTRC("Predictor"
     )); | 237         predictor = ((CPDF_Dictionary*)pParams)->GetInteger(FX_BSTRC("Predictor"
     )); | 
| 239         bEarlyChange = ((CPDF_Dictionary*)pParams)->GetInteger(FX_BSTRC("EarlyCh
     ange"), 1); |  | 
| 240         Colors = pParams->GetInteger(FX_BSTRC("Colors"), 1); | 238         Colors = pParams->GetInteger(FX_BSTRC("Colors"), 1); | 
| 241         BitsPerComponent = pParams->GetInteger(FX_BSTRC("BitsPerComponent"), 8); | 239         BitsPerComponent = pParams->GetInteger(FX_BSTRC("BitsPerComponent"), 8); | 
| 242         Columns = pParams->GetInteger(FX_BSTRC("Columns"), 1); | 240         Columns = pParams->GetInteger(FX_BSTRC("Columns"), 1); | 
| 243         if (!CheckFlateDecodeParams(Colors, BitsPerComponent, Columns)) { | 241         if (!CheckFlateDecodeParams(Colors, BitsPerComponent, Columns)) { | 
| 244             return NULL; | 242             return NULL; | 
| 245         } | 243         } | 
| 246     } | 244     } | 
| 247     return CPDF_ModuleMgr::Get()->GetFlateModule()->CreateDecoder(src_buf, src_s
     ize, width, height, | 245     return CPDF_ModuleMgr::Get()->GetFlateModule()->CreateDecoder(src_buf, src_s
     ize, width, height, | 
| 248             nComps, bpc, predictor, Colors, BitsPerComponent, Columns); | 246             nComps, bpc, predictor, Colors, BitsPerComponent, Columns); | 
| 249 } | 247 } | 
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 521     } | 519     } | 
| 522 } | 520 } | 
| 523 FX_DWORD FlateDecode(const FX_BYTE* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_
     buf, FX_DWORD& dest_size) | 521 FX_DWORD FlateDecode(const FX_BYTE* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_
     buf, FX_DWORD& dest_size) | 
| 524 { | 522 { | 
| 525     CCodec_ModuleMgr* pEncoders = CPDF_ModuleMgr::Get()->GetCodecModule(); | 523     CCodec_ModuleMgr* pEncoders = CPDF_ModuleMgr::Get()->GetCodecModule(); | 
| 526     if (pEncoders) { | 524     if (pEncoders) { | 
| 527         return pEncoders->GetFlateModule()->FlateOrLZWDecode(FALSE, src_buf, src
     _size, FALSE, 0, 0, 0, 0, 0, dest_buf, dest_size); | 525         return pEncoders->GetFlateModule()->FlateOrLZWDecode(FALSE, src_buf, src
     _size, FALSE, 0, 0, 0, 0, 0, dest_buf, dest_size); | 
| 528     } | 526     } | 
| 529     return 0; | 527     return 0; | 
| 530 } | 528 } | 
| OLD | NEW | 
|---|