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

Issue with COSObjectKey::fixGeneration

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.23, 3.0.3 JBIG2
    • Fix Version/s: 2.0.24, 3.0.0 PDFBox
    • Component/s: Parsing
    • Labels:
      None
    • Flags:
      Patch

      Description

      I think, I've just found a little bug within
      COSParser::validateXrefOffsets, which occures when a xref generation is
      corrected using COSObjectKey::fixGeneration.

      The issue is, that COSObjectKey is used as a hash-key and this instance
      is modified with fixGeneration.
      Because of this modification, the hasCode of the COSObjectKey is changed
      and the associated hashmap entry cannot longer be found in the xrefTable.
      Hashmap key objects should better be immutabel (see
      https://howtodoinjava.com/java/collections/hashmap/design-good-key-for-hashmap/)
      According to the change history, this issue was introduced with a commit
      for PDFBOX-4153, but PDFBOX-4490 seems also be related.

       

      Attached patch-file contains bot, the bugfix and the proposed optimization within COSObjectKey.

        Attachments

          Activity

            People

            • Assignee:
              lehmi Andreas Lehmkühler
              Reporter:
              rolandmeub Roland Meub
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: