Index: core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp |
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp |
index 2d6e9f3436561e59d98aad8c0a708ef0339952c2..55c62e287801d209010e96757263bfeaf7b5e1b3 100644 |
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp |
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp |
@@ -283,7 +283,7 @@ ICodec_ScanlineDecoder* FPDFAPI_CreateFlateDecoder( |
int predictor = 0; |
int Colors = 0, BitsPerComponent = 0, Columns = 0; |
if (pParams) { |
- predictor = ((CPDF_Dictionary*)pParams)->GetInteger(FX_BSTRC("Predictor")); |
+ predictor = pParams->GetInteger(FX_BSTRC("Predictor")); |
Colors = pParams->GetInteger(FX_BSTRC("Colors"), 1); |
BitsPerComponent = pParams->GetInteger(FX_BSTRC("BitsPerComponent"), 8); |
Columns = pParams->GetInteger(FX_BSTRC("Columns"), 1); |
@@ -306,9 +306,8 @@ FX_DWORD FPDFAPI_FlateOrLZWDecode(FX_BOOL bLZW, |
FX_BOOL bEarlyChange = TRUE; |
int Colors = 0, BitsPerComponent = 0, Columns = 0; |
if (pParams) { |
- predictor = ((CPDF_Dictionary*)pParams)->GetInteger(FX_BSTRC("Predictor")); |
- bEarlyChange = |
- ((CPDF_Dictionary*)pParams)->GetInteger(FX_BSTRC("EarlyChange"), 1); |
+ predictor = pParams->GetInteger(FX_BSTRC("Predictor")); |
+ bEarlyChange = pParams->GetInteger(FX_BSTRC("EarlyChange"), 1); |
Colors = pParams->GetInteger(FX_BSTRC("Colors"), 1); |
BitsPerComponent = pParams->GetInteger(FX_BSTRC("BitsPerComponent"), 8); |
Columns = pParams->GetInteger(FX_BSTRC("Columns"), 1); |
@@ -365,7 +364,9 @@ FX_BOOL PDF_DataDecode(const uint8_t* src_buf, |
int estimated_size = |
i == DecoderList.GetSize() - 1 ? last_estimated_size : 0; |
CFX_ByteString decoder = DecoderList[i]; |
- CPDF_Dictionary* pParam = (CPDF_Dictionary*)ParamList[i]; |
+ // Use ToDictionary here because we can push NULL into the ParamList. |
+ CPDF_Dictionary* pParam = |
+ ToDictionary(static_cast<CPDF_Object*>(ParamList[i])); |
uint8_t* new_buf = NULL; |
FX_DWORD new_size = (FX_DWORD)-1; |
int offset = -1; |