Chromium Code Reviews| Index: core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp |
| diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp |
| index 984e08d882cd04f95c9ce223500c18ac8ac40f3e..4dde9836b45273e00a1a4231639e4b48e167fa34 100644 |
| --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp |
| +++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp |
| @@ -2528,11 +2528,14 @@ CPDF_Stream* CPDF_SyntaxParser::ReadStream(CPDF_Dictionary* pDict, |
| } |
| m_Pos = streamStartPos; |
| } |
| - if (len <= 0) { |
| + if (len < 0) { |
| return nullptr; |
| } |
| - uint8_t* pData = FX_Alloc(uint8_t, len); |
| - ReadBlock(pData, len); |
| + uint8_t* pData = nullptr; |
| + if (len > 0) { |
| + pData = FX_Alloc(uint8_t, len); |
| + ReadBlock(pData, len); |
| + } |
| if (pCryptoHandler) { |
|
jun_fang
2015/10/08 09:19:52
If pData is nullptr, there is no data to be decryp
Lei Zhang
2015/10/08 17:21:49
Ok. Since |pData| can only be a nullptr when len =
|
| CFX_BinaryBuf dest_buf; |
| dest_buf.EstimateSize(pCryptoHandler->DecryptGetSize(len)); |