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

Non-termination in PDResources.createKey()

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • 2.0.0
    • None
    • PDModel

    Description

      When trying to set a font using CSPageContentStream.setFont() a new key is required which is created in PDResources.createKey(), ca line 450.

      If the dict keySet contains "F1", "F2", "F4", "F5" then just trying to use

      (dict.keySet().size() + 1)
      

      will not find a new key und the loop won't terminate.

      This here terminates:

              String key;
              int i = dict.keySet().size();
              do
              {
                  i++;
                  key = prefix + i;
              }
              while (dict.containsKey(key));
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              friemen Falko Riemenschneider
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: