You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Sean Bridges (JIRA)" <ji...@apache.org> on 2009/03/18 19:09:50 UTC

[jira] Created: (PDFBOX-442) race condition in PdfFont

race condition in PdfFont
-------------------------

                 Key: PDFBOX-442
                 URL: https://issues.apache.org/jira/browse/PDFBOX-442
             Project: PDFBox
          Issue Type: Bug
    Affects Versions: 0.7.3
            Reporter: Sean Bridges


this code in PDFFont.encode isn't thread safe,

                        COSName encodingName = (COSName)encoding;
                        cmap = (CMap)cmapObjects.get( encodingName );
                        if( cmap != null )
                        {
                            cmap = (CMap)cmapObjects.get( encodingName );
                        }

cmap may be cleared in PDFont.clearResources(), and it may be cleared in the interval between the two get() calls.  The first get() may be non null, while the second may be null.  The second get may be removed altogether.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (PDFBOX-442) race condition in PdfFont

Posted by "Andreas Lehmkühler (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/PDFBOX-442?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andreas Lehmkühler resolved PDFBOX-442.
---------------------------------------

       Resolution: Fixed
    Fix Version/s: 0.8.0-incubator

The second get on the map isn't needed. If we have the value, than we don't have to get it twice. Furthermore the cmapObjects is a synchronized map so that all accesses to that class-member shouldn't  be critical even in a multithreded environment.
I've delete the unneeded second get on the map with version 773370.

> race condition in PdfFont
> -------------------------
>
>                 Key: PDFBOX-442
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-442
>             Project: PDFBox
>          Issue Type: Bug
>    Affects Versions: 0.7.3
>            Reporter: Sean Bridges
>             Fix For: 0.8.0-incubator
>
>
> this code in PDFFont.encode isn't thread safe,
>                         COSName encodingName = (COSName)encoding;
>                         cmap = (CMap)cmapObjects.get( encodingName );
>                         if( cmap != null )
>                         {
>                             cmap = (CMap)cmapObjects.get( encodingName );
>                         }
> cmap may be cleared in PDFont.clearResources(), and it may be cleared in the interval between the two get() calls.  The first get() may be non null, while the second may be null.  The second get may be removed altogether.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.