Author: tilman Date: Wed Jul 23 10:49:06 2025 New Revision: 1927433 Log: PDFBOX-6043: add test
Modified: pdfbox/branches/3.0/fontbox/src/test/java/org/apache/fontbox/type1/Type1LexerTest.java Modified: pdfbox/branches/3.0/fontbox/src/test/java/org/apache/fontbox/type1/Type1LexerTest.java ============================================================================== --- pdfbox/branches/3.0/fontbox/src/test/java/org/apache/fontbox/type1/Type1LexerTest.java Wed Jul 23 10:49:03 2025 (r1927432) +++ pdfbox/branches/3.0/fontbox/src/test/java/org/apache/fontbox/type1/Type1LexerTest.java Wed Jul 23 10:49:06 2025 (r1927433) @@ -33,10 +33,6 @@ import org.junit.jupiter.api.Test; class Type1LexerTest { - Type1LexerTest() - { - } - /** * PDFBOX-5155: test real numbers. */ @@ -134,6 +130,21 @@ class Type1LexerTest Assertions.assertEquals("ND", tokens.get(2).getText()); } + /** + * PDFBOX-6043: test for detection of illegal string length. + * + * @throws IOException + */ + @Test + void TestPDFBOX6043() throws IOException + { + String s = "999 RD"; + Type1Lexer t1l = new Type1Lexer(s.getBytes(StandardCharsets.US_ASCII)); + IOException ex = + Assertions.assertThrows(IOException.class, () -> readTokens(t1l)); + Assertions.assertEquals("String length 999 is larger than input", ex.getMessage()); + } + private List<Token> readTokens(Type1Lexer t1l) throws IOException { Token nextToken;