[ 
https://issues.apache.org/jira/browse/PDFBOX-2655?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14304417#comment-14304417
 ] 

ASF subversion and git services commented on PDFBOX-2655:
---------------------------------------------------------

Commit 1656961 from [~jahewson] in branch 'pdfbox/trunk'
[ https://svn.apache.org/r1656961 ]

PDFBOX-2655: Fix CIDSet calculation

> PDCIDFontType2Embedder.buildCIDSet()  ArrayOutOfBounds
> ------------------------------------------------------
>
>                 Key: PDFBOX-2655
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-2655
>             Project: PDFBox
>          Issue Type: Bug
>          Components: PDModel
>    Affects Versions: 2.0.0
>            Reporter: Alex Nevidomsky
>            Assignee: John Hewson
>
> {code}
> byte[] bytes = new byte[(Collections.max(cidToGid.keySet()) + 7) / 8];
> ...
> bytes[cid / 8] |= mask;
> {code}
> Problem:
> [(N+7)/8] is not enough to store N/8 when N=8k (for example, 8).
> (N+8)/8 or N/8+1 seem to solve the problem, but not sure about the potential 
> remote consequences.
> Test case:
> {code}
>               PDDocument document = new PDDocument();
>               PDPage page = new PDPage(PDRectangle.A4);
>               document.addPage(page);
>               String dir = "../../resources/";
>               PDType0Font font = PDType0Font.load(document, new File(dir + 
> "LiberationSans-Regular.ttf"));
>               PDPageContentStream stream = new PDPageContentStream(document, 
> page);
>               stream.beginText();
>               stream.setFont(font, 12);
>               stream.setLeading(12 * 1.2);
>               stream.newLineAtOffset(50, 600);
>               //This particular Russian letter has been
>               //a trouble maker in computer system for decades )
>               stream.showText("я");
>               stream.endText();
>               stream.close();
>               document.save("example.pdf");
>               document.close();
> {code}



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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to