You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Falko Riemenschneider (JIRA)" <ji...@apache.org> on 2015/07/29 12:04:04 UTC

[jira] [Created] (PDFBOX-2907) Non-termination in PDResources.createKey()

Falko Riemenschneider created PDFBOX-2907:
---------------------------------------------

             Summary: Non-termination in PDResources.createKey()
                 Key: PDFBOX-2907
                 URL: https://issues.apache.org/jira/browse/PDFBOX-2907
             Project: PDFBox
          Issue Type: Bug
          Components: PDModel
    Affects Versions: 2.0.0
            Reporter: Falko Riemenschneider


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 
{code}
(dict.keySet().size() + 1)
{code} 
will not find a new key und the loop won't terminate.

This here terminates:
{code}
        String key;
        int i = dict.keySet().size();
        do
        {
            i++;
            key = prefix + i;
        }
        while (dict.containsKey(key));
{code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org