Fix more nits in GetDecoderArray().
- Rename |pDecoder| to |pFilter|, since |pDecoders| also exists.
- Add an assertion in the case when the filter is a name.
Change-Id: Icf78f8fe5b0b798d21fc18ffb94584809406528b
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/67751
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/core/fpdfapi/parser/fpdf_parser_decode.cpp b/core/fpdfapi/parser/fpdf_parser_decode.cpp
index be6a797..1d19159 100644
--- a/core/fpdfapi/parser/fpdf_parser_decode.cpp
+++ b/core/fpdfapi/parser/fpdf_parser_decode.cpp
@@ -366,15 +366,15 @@
}
Optional<DecoderArray> GetDecoderArray(const CPDF_Dictionary* pDict) {
- const CPDF_Object* pDecoder = pDict->GetDirectObjectFor("Filter");
- if (!pDecoder || (!pDecoder->IsArray() && !pDecoder->IsName()))
+ const CPDF_Object* pFilter = pDict->GetDirectObjectFor("Filter");
+ if (!pFilter || (!pFilter->IsArray() && !pFilter->IsName()))
return pdfium::nullopt;
const CPDF_Object* pParams =
pDict->GetDirectObjectFor(pdfium::stream::kDecodeParms);
DecoderArray decoder_array;
- if (const CPDF_Array* pDecoders = pDecoder->AsArray()) {
+ if (const CPDF_Array* pDecoders = pFilter->AsArray()) {
if (!ValidateDecoderPipeline(pDecoders))
return pdfium::nullopt;
@@ -385,8 +385,9 @@
pParamsArray ? pParamsArray->GetDictAt(i) : nullptr});
}
} else {
+ ASSERT(pFilter->IsName());
decoder_array.push_back(
- {pDecoder->GetString(), pParams ? pParams->GetDict() : nullptr});
+ {pFilter->GetString(), pParams ? pParams->GetDict() : nullptr});
}
return decoder_array;