You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Max Gilead (JIRA)" <ji...@apache.org> on 2017/12/11 10:58:00 UTC

[jira] [Updated] (PDFBOX-4033) KerningSubtable should skip zero-length kerning subtables

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

Max Gilead updated PDFBOX-4033:
-------------------------------
    Description: 
DejaVuSansLight has a zero-length kerning subtable. This currently triggers an IOException but it seems to be safe to ignore such tables.

The simple fix below (the {color:red}BLOCK ADDED{color} block) makes PDFBox work with fonts like that.

We must use a locally-patched PDFBox fork as it is paramount to us that it works uninterrupted as much as possible, even with less-than-ideal data.

{quote}private void readSubtable0(TTFDataStream data) throws IOException
    {
        int version = data.readUnsignedShort();
        if (version != 0)
        {
            LOG.info("Unsupported kerning sub-table version: " + version);
            return;
        }
        int length = data.readUnsignedShort();
        if (length < 6)
        {
            {color:red}if (length == 0) // BLOCK ADDED
            {
                LOG.info("Kerning sub-table empty, skipping.");
                return;
            }{color}
            throw new IOException("Kerning sub-table too short, got " + length
                    + " bytes, expect 6 or more.");
        }
{quote}

  was:
DejaVuSansLight has a zero-length kerning subtable. This currently triggers an IOException but it seems to be safe to ignore such tables.

The simple fix below (the {color:red}BLOCK ADDED{color} block) makes PDFBox work with fonts like that.

We must use a locally-patched PDFBox fork as it is paramount to us that it works uninterrupted as much as possible, even with less-than-ideal data.

??private void readSubtable0(TTFDataStream data) throws IOException
    {
        int version = data.readUnsignedShort();
        if (version != 0)
        {
            LOG.info("Unsupported kerning sub-table version: " + version);
            return;
        }
        int length = data.readUnsignedShort();
        if (length < 6)
        {
            {color:red}if (length == 0) // BLOCK ADDED
            {
                LOG.info("Kerning sub-table empty, skipping.");
                return;
            }{color}
            throw new IOException("Kerning sub-table too short, got " + length
                    + " bytes, expect 6 or more.");
        }
??


> KerningSubtable should skip zero-length kerning subtables
> ---------------------------------------------------------
>
>                 Key: PDFBOX-4033
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-4033
>             Project: PDFBox
>          Issue Type: Bug
>          Components: FontBox
>    Affects Versions: 2.0.8
>         Environment: Any
>            Reporter: Max Gilead
>              Labels: easyfix
>
> DejaVuSansLight has a zero-length kerning subtable. This currently triggers an IOException but it seems to be safe to ignore such tables.
> The simple fix below (the {color:red}BLOCK ADDED{color} block) makes PDFBox work with fonts like that.
> We must use a locally-patched PDFBox fork as it is paramount to us that it works uninterrupted as much as possible, even with less-than-ideal data.
> {quote}private void readSubtable0(TTFDataStream data) throws IOException
>     {
>         int version = data.readUnsignedShort();
>         if (version != 0)
>         {
>             LOG.info("Unsupported kerning sub-table version: " + version);
>             return;
>         }
>         int length = data.readUnsignedShort();
>         if (length < 6)
>         {
>             {color:red}if (length == 0) // BLOCK ADDED
>             {
>                 LOG.info("Kerning sub-table empty, skipping.");
>                 return;
>             }{color}
>             throw new IOException("Kerning sub-table too short, got " + length
>                     + " bytes, expect 6 or more.");
>         }
> {quote}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

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