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

Tilman Hausherr updated PDFBOX-6344:
------------------------------------
    Affects Version/s: 2.0.37

> Type2 charstring 16.16 fixed point operands are decoded with a 1/65535 
> fraction
> -------------------------------------------------------------------------------
>
>                 Key: PDFBOX-6344
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-6344
>             Project: PDFBox
>          Issue Type: Bug
>          Components: FontBox
>    Affects Versions: 2.0.37, 3.0.8 PDFBox, 4.0.0
>            Reporter: Martin Mirchev
>            Priority: Major
>         Attachments: type2-fixed-16-16.patch
>
>
> {{Type2CharStringParser.readNumber}} decodes an operand that starts with byte 
> 255 as {{value + input.readUnsignedShort() / 65535d}}. The Type 2 charstring 
> format defines this operand as a 16.16 fixed point number, so the fraction is 
> in units of 1/65536: {{00 01 80 00}} is 1.5, but PDFBox gives 1.5000076. The 
> error is small, but every fixed-point coordinate and width in a CFF font is 
> affected.
> The attached patch divides by 65536 and adds a test to 
> {{Type2CharStringParserTest}} for 1.5 and -1.5. The test fails without the 
> change, and the fontbox tests pass with it.
> This issue was found by an LLM-assisted tool and verified manually.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

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

Reply via email to