From 8ed949d3dcdcb826c16acc9129eaf168c2ea8134 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Thu, 2 Aug 2018 18:42:06 +0000 Subject: 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 Commit-Queue: Lei Zhang --- core/fpdfapi/parser/cpdf_linearized_header.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'core') diff --git a/core/fpdfapi/parser/cpdf_linearized_header.cpp b/core/fpdfapi/parser/cpdf_linearized_header.cpp index 8286e0fbe3..da7a7ad384 100644 --- a/core/fpdfapi/parser/cpdf_linearized_header.cpp +++ b/core/fpdfapi/parser/cpdf_linearized_header.cpp @@ -41,11 +41,9 @@ bool IsLinearizedHeaderValid(const CPDF_LinearizedHeader* header, FX_FILESIZE document_size) { ASSERT(header); return header->GetFileSize() == document_size && - static_cast(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 @@ std::unique_ptr CPDF_LinearizedHeader::Parse( !IsValidNumericDictionaryValue(pDict.get(), "L", 1) || !IsValidNumericDictionaryValue(pDict.get(), "P", 0, false) || !IsValidNumericDictionaryValue(pDict.get(), "T", 1) || - !IsValidNumericDictionaryValue(pDict.get(), "N", 0) || + !IsValidNumericDictionaryValue(pDict.get(), "N", 1) || !IsValidNumericDictionaryValue(pDict.get(), "E", 1) || !IsValidNumericDictionaryValue(pDict.get(), "O", 1)) { return nullptr; -- cgit v1.2.3