| 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 "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h" | 7 #include "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h" |
| 8 | 8 |
| 9 #include <limits.h> | 9 #include <limits.h> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 break; | 218 break; |
| 219 } | 219 } |
| 220 } | 220 } |
| 221 uint32_t ret = i + 1; | 221 uint32_t ret = i + 1; |
| 222 if (ret > src_size) { | 222 if (ret > src_size) { |
| 223 ret = src_size; | 223 ret = src_size; |
| 224 } | 224 } |
| 225 return ret; | 225 return ret; |
| 226 } | 226 } |
| 227 | 227 |
| 228 ICodec_ScanlineDecoder* FPDFAPI_CreateFaxDecoder( | 228 CCodec_ScanlineDecoder* FPDFAPI_CreateFaxDecoder( |
| 229 const uint8_t* src_buf, | 229 const uint8_t* src_buf, |
| 230 uint32_t src_size, | 230 uint32_t src_size, |
| 231 int width, | 231 int width, |
| 232 int height, | 232 int height, |
| 233 const CPDF_Dictionary* pParams) { | 233 const CPDF_Dictionary* pParams) { |
| 234 int K = 0; | 234 int K = 0; |
| 235 FX_BOOL EndOfLine = FALSE; | 235 FX_BOOL EndOfLine = FALSE; |
| 236 FX_BOOL ByteAlign = FALSE; | 236 FX_BOOL ByteAlign = FALSE; |
| 237 FX_BOOL BlackIs1 = FALSE; | 237 FX_BOOL BlackIs1 = FALSE; |
| 238 int Columns = 1728; | 238 int Columns = 1728; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 (check > 0 && BitsPerComponent > INT_MAX / check)) { | 271 (check > 0 && BitsPerComponent > INT_MAX / check)) { |
| 272 return FALSE; | 272 return FALSE; |
| 273 } | 273 } |
| 274 check *= BitsPerComponent; | 274 check *= BitsPerComponent; |
| 275 if (check > INT_MAX - 7) { | 275 if (check > INT_MAX - 7) { |
| 276 return FALSE; | 276 return FALSE; |
| 277 } | 277 } |
| 278 return TRUE; | 278 return TRUE; |
| 279 } | 279 } |
| 280 | 280 |
| 281 ICodec_ScanlineDecoder* FPDFAPI_CreateFlateDecoder( | 281 CCodec_ScanlineDecoder* FPDFAPI_CreateFlateDecoder( |
| 282 const uint8_t* src_buf, | 282 const uint8_t* src_buf, |
| 283 uint32_t src_size, | 283 uint32_t src_size, |
| 284 int width, | 284 int width, |
| 285 int height, | 285 int height, |
| 286 int nComps, | 286 int nComps, |
| 287 int bpc, | 287 int bpc, |
| 288 const CPDF_Dictionary* pParams) { | 288 const CPDF_Dictionary* pParams) { |
| 289 int predictor = 0; | 289 int predictor = 0; |
| 290 int Colors = 0, BitsPerComponent = 0, Columns = 0; | 290 int Colors = 0, BitsPerComponent = 0, Columns = 0; |
| 291 if (pParams) { | 291 if (pParams) { |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 580 uint32_t src_size, | 580 uint32_t src_size, |
| 581 uint8_t*& dest_buf, | 581 uint8_t*& dest_buf, |
| 582 uint32_t& dest_size) { | 582 uint32_t& dest_size) { |
| 583 CCodec_ModuleMgr* pEncoders = CPDF_ModuleMgr::Get()->GetCodecModule(); | 583 CCodec_ModuleMgr* pEncoders = CPDF_ModuleMgr::Get()->GetCodecModule(); |
| 584 if (pEncoders) { | 584 if (pEncoders) { |
| 585 return pEncoders->GetFlateModule()->FlateOrLZWDecode( | 585 return pEncoders->GetFlateModule()->FlateOrLZWDecode( |
| 586 FALSE, src_buf, src_size, FALSE, 0, 0, 0, 0, 0, dest_buf, dest_size); | 586 FALSE, src_buf, src_size, FALSE, 0, 0, 0, 0, 0, dest_buf, dest_size); |
| 587 } | 587 } |
| 588 return 0; | 588 return 0; |
| 589 } | 589 } |
| OLD | NEW |