diff options
author | Lei Zhang <thestig@chromium.org> | 2018-09-11 07:58:38 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-09-11 07:58:38 +0000 |
commit | c2f404f993f13d303f9e47d2f97aff727becac7d (patch) | |
tree | 29d29f827c701da54334b894364ec5ea12dedc96 /core/fpdfapi/page | |
parent | 8365e76fe8a311eaf77c4b5d5c0b199de0238f07 (diff) | |
download | pdfium-c2f404f993f13d303f9e47d2f97aff727becac7d.tar.xz |
Make RunLengthDecode()'s buffer out parameter a unique_ptr.
Change-Id: I1dc99831a564e88035c317455411f1eba9aa41c4
Reviewed-on: https://pdfium-review.googlesource.com/41852
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 | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/core/fpdfapi/page/cpdf_streamparser.cpp b/core/fpdfapi/page/cpdf_streamparser.cpp index fe67634196..69205cb934 100644 --- a/core/fpdfapi/page/cpdf_streamparser.cpp +++ b/core/fpdfapi/page/cpdf_streamparser.cpp @@ -70,16 +70,6 @@ uint32_t DecodeInlineStream(pdfium::span<const uint8_t> src_span, 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, &ignored_result, dest_size); - if (decoder == "ASCIIHexDecode" || decoder == "AHx") - 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); @@ -93,8 +83,19 @@ uint32_t DecodeInlineStream(pdfium::span<const uint8_t> src_span, !pParam || pParam->GetIntegerFor("ColorTransform", 1)); return DecodeAllScanlines(std::move(pDecoder), dest_buf, dest_size); } + 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, &ignored_result, dest_size); + if (decoder == "ASCIIHexDecode" || decoder == "AHx") + return HexDecode(src_span, &ignored_result, dest_size); if (decoder == "RunLengthDecode" || decoder == "RL") - return RunLengthDecode(src_span, dest_buf, dest_size); + return RunLengthDecode(src_span, &ignored_result, dest_size); return FX_INVALID_OFFSET; } |