CHECK() on negative sizes in CPDF_SyntaxParser::SetPos().

This would have diagnosed two recent bugs.

Change-Id: I2598ca813c784587620088f0d529be94294f601a
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/93613
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
diff --git a/core/fpdfapi/parser/cpdf_syntax_parser.cpp b/core/fpdfapi/parser/cpdf_syntax_parser.cpp
index 61532d2..e8edc42 100644
--- a/core/fpdfapi/parser/cpdf_syntax_parser.cpp
+++ b/core/fpdfapi/parser/cpdf_syntax_parser.cpp
@@ -481,6 +481,7 @@
 }
 
 void CPDF_SyntaxParser::SetPos(FX_FILESIZE pos) {
+  CHECK_GE(pos, 0);
   m_Pos = std::min(pos, m_FileLen);
 }
 
diff --git a/core/fpdfapi/parser/cpdf_syntax_parser_unittest.cpp b/core/fpdfapi/parser/cpdf_syntax_parser_unittest.cpp
index 9ccaf31..1c7d92d 100644
--- a/core/fpdfapi/parser/cpdf_syntax_parser_unittest.cpp
+++ b/core/fpdfapi/parser/cpdf_syntax_parser_unittest.cpp
@@ -87,9 +87,6 @@
     parser.SetPos(6);
     EXPECT_EQ("", parser.ReadHexString());
 
-    parser.SetPos(-1);
-    EXPECT_EQ("", parser.ReadHexString());
-
     parser.SetPos(std::numeric_limits<FX_FILESIZE>::max());
     EXPECT_EQ("", parser.ReadHexString());