Author: tilman
Date: Wed Jul 23 10:49:03 2025
New Revision: 1927432

Log:
PDFBOX-6043: add test

Modified:
   
pdfbox/branches/2.0/fontbox/src/test/java/org/apache/fontbox/type1/Type1LexerTest.java

Modified: 
pdfbox/branches/2.0/fontbox/src/test/java/org/apache/fontbox/type1/Type1LexerTest.java
==============================================================================
--- 
pdfbox/branches/2.0/fontbox/src/test/java/org/apache/fontbox/type1/Type1LexerTest.java
      Wed Jul 23 10:48:59 2025        (r1927431)
+++ 
pdfbox/branches/2.0/fontbox/src/test/java/org/apache/fontbox/type1/Type1LexerTest.java
      Wed Jul 23 10:49:03 2025        (r1927432)
@@ -135,6 +135,28 @@ public class Type1LexerTest
         Assert.assertEquals("ND", tokens.get(2).getText());
     }
 
+    /**
+     * PDFBOX-6043: test for detection of illegal string length.
+     *
+     * @throws IOException 
+     */
+    @Test
+    public void TestPDFBOX6043() throws IOException
+    {
+        String s = "999 RD";
+        Type1Lexer t1l = new Type1Lexer(s.getBytes(Charsets.US_ASCII));
+        try
+        {
+            readTokens(t1l);
+        }
+        catch (IOException ex)
+        {
+            Assert.assertEquals("String length 999 is larger than input", 
ex.getMessage());
+            return;
+        }
+        Assert.fail();
+    }
+
     private List<Token> readTokens(Type1Lexer t1l) throws IOException
     {
         Token nextToken;

Reply via email to