Remove some checks in IsLinearizedHeaderValid(). One check can never fail. The other check can be done earlier, before creating the CPDF_LinearizedHeader. Change-Id: I0bccb2a9e19e0d5517daf96684adba6bb3a203bf Reviewed-on: https://pdfium-review.googlesource.com/39412 Reviewed-by: Art Snake <art-snake@yandex-team.ru> Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/core/fpdfapi/parser/cpdf_linearized_header.cpp b/core/fpdfapi/parser/cpdf_linearized_header.cpp index 8286e0f..da7a7ad 100644 --- a/core/fpdfapi/parser/cpdf_linearized_header.cpp +++ b/core/fpdfapi/parser/cpdf_linearized_header.cpp
@@ -41,11 +41,9 @@ FX_FILESIZE document_size) { ASSERT(header); return header->GetFileSize() == document_size && - static_cast<int>(header->GetFirstPageNo()) >= 0 && header->GetFirstPageNo() < kMaxInt && header->GetFirstPageNo() < header->GetPageCount() && header->GetMainXRefTableFirstEntryOffset() < document_size && - header->GetPageCount() > 0 && header->GetFirstPageEndOffset() < document_size && header->GetLastXRefOffset() < document_size && header->GetHintStart() < document_size; @@ -65,7 +63,7 @@ !IsValidNumericDictionaryValue<FX_FILESIZE>(pDict.get(), "L", 1) || !IsValidNumericDictionaryValue<uint32_t>(pDict.get(), "P", 0, false) || !IsValidNumericDictionaryValue<FX_FILESIZE>(pDict.get(), "T", 1) || - !IsValidNumericDictionaryValue<uint32_t>(pDict.get(), "N", 0) || + !IsValidNumericDictionaryValue<uint32_t>(pDict.get(), "N", 1) || !IsValidNumericDictionaryValue<FX_FILESIZE>(pDict.get(), "E", 1) || !IsValidNumericDictionaryValue<uint32_t>(pDict.get(), "O", 1)) { return nullptr;