diff options
author | Lei Zhang <thestig@chromium.org> | 2018-09-11 07:57:48 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-09-11 07:57:48 +0000 |
commit | 8365e76fe8a311eaf77c4b5d5c0b199de0238f07 (patch) | |
tree | c30b4fc3079c254432e120d211933ba89c80f69e /core/fpdfapi/page | |
parent | 8550a2d1e037ef444e8ac340ea70001c7a25091c (diff) | |
download | pdfium-8365e76fe8a311eaf77c4b5d5c0b199de0238f07.tar.xz |
Make HexDecode()'s buffer out parameter a unique_ptr.
Do the same for A85Decode().
Change-Id: Ic6a0e5e8a63defa104e35e97eb9ce4223aac23a7
Reviewed-on: https://pdfium-review.googlesource.com/41851
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'core/fpdfapi/page')
-rw-r--r-- | core/fpdfapi/page/cpdf_streamparser.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/core/fpdfapi/page/cpdf_streamparser.cpp b/core/fpdfapi/page/cpdf_streamparser.cpp index 9533bb2a17..fe67634196 100644 --- a/core/fpdfapi/page/cpdf_streamparser.cpp +++ b/core/fpdfapi/page/cpdf_streamparser.cpp @@ -68,22 +68,24 @@ uint32_t DecodeInlineStream(pdfium::span<const uint8_t> src_span, CPDF_Dictionary* pParam, uint8_t** dest_buf, uint32_t* dest_size) { + *dest_buf = nullptr; + *dest_size = 0; if (decoder == "CCITTFaxDecode" || decoder == "CCF") { std::unique_ptr<CCodec_ScanlineDecoder> pDecoder = CreateFaxDecoder(src_span, width, height, pParam); return DecodeAllScanlines(std::move(pDecoder), dest_buf, dest_size); } + std::unique_ptr<uint8_t, FxFreeDeleter> ignored_result; if (decoder == "ASCII85Decode" || decoder == "A85") - return A85Decode(src_span, dest_buf, dest_size); + return A85Decode(src_span, &ignored_result, dest_size); if (decoder == "ASCIIHexDecode" || decoder == "AHx") - return HexDecode(src_span, dest_buf, dest_size); + return HexDecode(src_span, &ignored_result, dest_size); if (decoder == "FlateDecode" || decoder == "Fl") { return FlateOrLZWDecode(false, src_span, pParam, *dest_size, dest_buf, dest_size); } - if (decoder == "LZWDecode" || decoder == "LZW") { + if (decoder == "LZWDecode" || decoder == "LZW") return FlateOrLZWDecode(true, src_span, pParam, 0, dest_buf, dest_size); - } if (decoder == "DCTDecode" || decoder == "DCT") { std::unique_ptr<CCodec_ScanlineDecoder> pDecoder = CPDF_ModuleMgr::Get()->GetJpegModule()->CreateDecoder( @@ -93,9 +95,8 @@ uint32_t DecodeInlineStream(pdfium::span<const uint8_t> src_span, } if (decoder == "RunLengthDecode" || decoder == "RL") return RunLengthDecode(src_span, dest_buf, dest_size); - *dest_size = 0; - *dest_buf = 0; - return 0xFFFFFFFF; + + return FX_INVALID_OFFSET; } } // namespace |