[ 
https://issues.apache.org/jira/browse/PDFBOX-3554?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Andreas Lehmkühler closed PDFBOX-3554.
--------------------------------------
    Resolution: Duplicate

You are using an outdated version of PDFBox. This was fixed in 2.0.2, see 
PDFBOX-3327 for further information.

Anyway, thanks for the report!

> Crash in kerning calculations
> -----------------------------
>
>                 Key: PDFBOX-3554
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-3554
>             Project: PDFBox
>          Issue Type: Bug
>          Components: FontBox
>    Affects Versions: 2.0.0
>            Reporter: Lawrence Kesteloot
>            Assignee: Andreas Lehmkühler
>              Labels: easyfix
>
> A bug in the usage of the result of a binary search causes a crash in the 
> calculation of kerning information. Here's the patch:
> {code}
> --- a/fontbox/src/main/java/org/apache/fontbox/ttf/KerningSubtable.java
> +++ b/fontbox/src/main/java/org/apache/fontbox/ttf/KerningSubtable.java
> @@ -292,7 +292,7 @@ public class KerningSubtable
>              index = Arrays.binarySearch(pairs, searchRange, pairs.length, 
> key, this);
>              if (index >= 0)
>              {
> -                return pairs[searchRange + index][2];
> +                return pairs[index][2];
>              }
>              return 0;
>          }
> {code}
> Explanation: The searchRange parameter is passed to binarySearch(), but the 
> result of binarySearch() is relative to the start of the array, not the 
> passed-in start. So no need to add searchRange to the result. Adding causes 
> the indexing to go off the end of the array.



--
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