summaryrefslogtreecommitdiff
path: root/core/fpdfapi/page/cpdf_streamparser.cpp
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-09-11 07:59:18 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-09-11 07:59:18 +0000
commitbb06ae5ad0b6389490befc6831517ab383e94031 (patch)
tree97e9e2367db537f6a4f459481d77103973450b3c /core/fpdfapi/page/cpdf_streamparser.cpp
parentc2f404f993f13d303f9e47d2f97aff727becac7d (diff)
downloadpdfium-bb06ae5ad0b6389490befc6831517ab383e94031.tar.xz
Make flate decode functions' buffer out parameter unique_ptrs.
Change-Id: Idb14846e87a8287dd911b0a2f7a32146e86c2af7 Reviewed-on: https://pdfium-review.googlesource.com/41853 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'core/fpdfapi/page/cpdf_streamparser.cpp')
-rw-r--r--core/fpdfapi/page/cpdf_streamparser.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/core/fpdfapi/page/cpdf_streamparser.cpp b/core/fpdfapi/page/cpdf_streamparser.cpp
index 69205cb934..88b3993327 100644
--- a/core/fpdfapi/page/cpdf_streamparser.cpp
+++ b/core/fpdfapi/page/cpdf_streamparser.cpp
@@ -70,12 +70,15 @@ uint32_t DecodeInlineStream(pdfium::span<const uint8_t> src_span,
uint32_t* dest_size) {
*dest_buf = nullptr;
*dest_size = 0;
+ std::unique_ptr<uint8_t, FxFreeDeleter> ignored_result;
if (decoder == "FlateDecode" || decoder == "Fl") {
- return FlateOrLZWDecode(false, src_span, pParam, *dest_size, dest_buf,
+ return FlateOrLZWDecode(false, src_span, pParam, *dest_size,
+ &ignored_result, dest_size);
+ }
+ if (decoder == "LZWDecode" || decoder == "LZW") {
+ return FlateOrLZWDecode(true, src_span, pParam, 0, &ignored_result,
dest_size);
}
- 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(
@@ -89,7 +92,6 @@ uint32_t DecodeInlineStream(pdfium::span<const uint8_t> src_span,
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")