Uploaded image for project: 'PDFBox'
  1. PDFBox
  2. PDFBOX-4451

ArrayIndexOutOfBoundsException in PDRectangle constructor

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.0.13
    • 2.0.14, 3.0.0 PDFBox
    • PDModel
    • None

    Description

      Fuzzing PDF merging with JQF triggered an ArrayIndexOutOfBoundsException. The attached file is merged with itself.

      java.lang.ArrayIndexOutOfBoundsException: 3
      
      	at org.apache.pdfbox.pdmodel.common.PDRectangle.<init>(PDRectangle.java:135)
      	at org.apache.pdfbox.pdmodel.PDPage.getMediaBox(PDPage.java:281)
      	at org.apache.pdfbox.pdmodel.PDPage.getCropBox(PDPage.java:325)
      	at org.apache.pdfbox.multipdf.PDFMergerUtility.appendDocument(PDFMergerUtility.java:740)
      	at org.apache.pdfbox.multipdf.PDFMergerUtility.legacyMergeDocuments(PDFMergerUtility.java:390)
      	at org.apache.pdfbox.multipdf.PDFMergerUtility.mergeDocuments(PDFMergerUtility.java:276)
      ...
      

      The Code used for fuzzing is

      try (OutputStream out = new ByteArrayOutputStream()) {
          PDFMergerUtility pdfMergerUtility = new PDFMergerUtility();
          pdfMergerUtility.addSource(file);
          pdfMergerUtility.addSource(file);
          pdfMergerUtility.setDestinationStream(out);
          pdfMergerUtility.mergeDocuments(MemoryUsageSetting.setupMainMemoryOnly());
      }
      

      Attachments

        Activity

          People

            tilman Tilman Hausherr
            rschimpf Robin Schimpf
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: