Uploaded image for project: 'Tika'
  1. Tika
  2. TIKA-2407

Tika crashed while parsing corrupt PDF

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 1.15
    • Fix Version/s: None
    • Component/s: parser
    • Labels:
      None

      Description

      Tika throws an exception when try to parse a corrupt PDF file to extract text content (see attached file):

      Caused by: org.apache.tika.exception.TikaException: TIKA-198: Illegal IOException from org.apache.tika.parser.pdf.PDFParser@d71dc5e
      	at org.apache.tika.parser.CompositeParser.parse(CompositeParser.java:286)
      	at org.apache.tika.parser.CompositeParser.parse(CompositeParser.java:280)
      	... 16 more
      Caused by: java.io.IOException: Error reading stream, expected='endstream' actual='' at offset 116070
      	at org.apache.pdfbox.pdfparser.COSParser.parseCOSStream(COSParser.java:1013)
      	at org.apache.pdfbox.pdfparser.COSParser.parseFileObject(COSParser.java:781)
      	at org.apache.pdfbox.pdfparser.COSParser.parseObjectDynamically(COSParser.java:742)
      	at org.apache.pdfbox.pdfparser.COSParser.parseObjectDynamically(COSParser.java:673)
      	at org.apache.pdfbox.pdfparser.COSParser.parseDictObjects(COSParser.java:633)
      	at org.apache.pdfbox.pdfparser.PDFParser.initialParse(PDFParser.java:241)
      	at org.apache.pdfbox.pdfparser.PDFParser.parse(PDFParser.java:276)
      	at org.apache.pdfbox.pdmodel.PDDocument.load(PDDocument.java:1132)
      	at org.apache.pdfbox.pdmodel.PDDocument.load(PDDocument.java:1066)
      	at org.apache.tika.parser.pdf.PDFParser.parse(PDFParser.java:141)
      	at org.apache.tika.parser.CompositeParser.parse(CompositeParser.java:280)
      	... 23 more
      

      Can you thrown a specific exception to allow better error handling? Something like BadInputException or WrongFileException?

        Attachments

        1. IOException.pdf
          113 kB
          Jorge Spinsanti

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              Giorgy Jorge Spinsanti
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated: