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

Pdfbox always sets the second part of documentID to the same value

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.8.8, 2.0.0
    • Fix Version/s: 1.8.9, 2.0.0
    • Component/s: PDModel
    • Labels:
      None

      Description

      From COSWriter.java lines 1268 (trunk) 1500 (1.8)

      COSString firstID = missingID ? new COSString( md5.digest() ) : (COSString)idArray.get(0);

      COSString secondID = new COSString( md5.digest() );

      Notice that digest is called in both lines

      The javadoc for md5.digest() goes
      "Completes the hash computation by performing final operations such as padding. The digest is reset after this call is made."

      So, if missingID == true then the secondID will always be the hash of the empty string.

      Acrobat reader uses this value for it's search index, as hinted at here
      https://stackoverflow.com/a/20201670

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                lehmi Andreas Lehmkühler
                Reporter:
                blekinge Asger Askov Blekinge
              • Votes:
                1 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: