You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Dave Smith (Created) (JIRA)" <ji...@apache.org> on 2012/02/21 14:34:34 UTC

[jira] [Created] (PDFBOX-1233) CCITTFaxG31DDecodeInputStream - Extended codes have wrong length

CCITTFaxG31DDecodeInputStream - Extended codes have wrong length
----------------------------------------------------------------

                 Key: PDFBOX-1233
                 URL: https://issues.apache.org/jira/browse/PDFBOX-1233
             Project: PDFBox
          Issue Type: Bug
            Reporter: Dave Smith


When dealing with large fax images there are Extended Make Up Codes.
They are added to the tree as ...

buildUpMakeUp(LONG_MAKE_UP, WHITE_LOOKUP_TREE_ROOT);
buildUpMakeUp(LONG_MAKE_UP, BLACK_LOOKUP_TREE_ROOT);

Accept, the length is 0 based not starting at 1792.

The quick hack is to create a new method so the length of the node is correct

 private static void buildUpMakeUpLong(short[] codes,
NonLeafLookupTreeNode root)
   {
       for (int len = 0, c = codes.length; len < c; len++)
       {
           LookupTreeNode leaf = new MakeUpTreeNode((len + 28) * 64);
           addLookupTreeNode(codes[len], root, leaf);
       }
   }

as thus ...

buildUpMakeUpLong(LONG_MAKE_UP, WHITE_LOOKUP_TREE_ROOT);
buildUpMakeUpLong(LONG_MAKE_UP, BLACK_LOOKUP_TREE_ROOT);

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Resolved] (PDFBOX-1233) CCITTFaxG31DDecodeInputStream - Extended codes have wrong length

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

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

       Resolution: Fixed
    Fix Version/s: 1.7.0
         Assignee: Andreas Lehmkühler

I was able to double check the patch using a sample pdf Dave sent me in private as it is confidential.

I added the patch in revision 1299358 as proposed.

Thanks for the contribution!
                
> CCITTFaxG31DDecodeInputStream - Extended codes have wrong length
> ----------------------------------------------------------------
>
>                 Key: PDFBOX-1233
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-1233
>             Project: PDFBox
>          Issue Type: Bug
>            Reporter: Dave Smith
>            Assignee: Andreas Lehmkühler
>             Fix For: 1.7.0
>
>
> When dealing with large fax images there are Extended Make Up Codes.
> They are added to the tree as ...
> buildUpMakeUp(LONG_MAKE_UP, WHITE_LOOKUP_TREE_ROOT);
> buildUpMakeUp(LONG_MAKE_UP, BLACK_LOOKUP_TREE_ROOT);
> Accept, the length is 0 based not starting at 1792.
> The quick hack is to create a new method so the length of the node is correct
>  private static void buildUpMakeUpLong(short[] codes,
> NonLeafLookupTreeNode root)
>    {
>        for (int len = 0, c = codes.length; len < c; len++)
>        {
>            LookupTreeNode leaf = new MakeUpTreeNode((len + 28) * 64);
>            addLookupTreeNode(codes[len], root, leaf);
>        }
>    }
> as thus ...
> buildUpMakeUpLong(LONG_MAKE_UP, WHITE_LOOKUP_TREE_ROOT);
> buildUpMakeUpLong(LONG_MAKE_UP, BLACK_LOOKUP_TREE_ROOT);

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Commented] (PDFBOX-1233) CCITTFaxG31DDecodeInputStream - Extended codes have wrong length

Posted by "Dave Smith (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/PDFBOX-1233?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13213585#comment-13213585 ] 

Dave Smith commented on PDFBOX-1233:
------------------------------------

I can not due to privacy reasons, but here is all the info you need

4 0 obj
<</Type/XObject
/Subtype/Image
/Width 2552
/Height 3300
/BitsPerComponent 1
/ColorSpace/DeviceGray
/Filter /CCITTFaxDecode
/DecodeParms <</Columns 2552 /Rows 3300>>
/Length 82636
>>
stream


First 10 bytes     0,18,-64,29,5,50,96,2,80,3,-96

The first line is  white 43 bits, black 2432 and then white 51 then EOL ... When you decode the 2432 line your extended line length is wrong because when you built the table you started at 0 not 1792

                
> CCITTFaxG31DDecodeInputStream - Extended codes have wrong length
> ----------------------------------------------------------------
>
>                 Key: PDFBOX-1233
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-1233
>             Project: PDFBox
>          Issue Type: Bug
>            Reporter: Dave Smith
>
> When dealing with large fax images there are Extended Make Up Codes.
> They are added to the tree as ...
> buildUpMakeUp(LONG_MAKE_UP, WHITE_LOOKUP_TREE_ROOT);
> buildUpMakeUp(LONG_MAKE_UP, BLACK_LOOKUP_TREE_ROOT);
> Accept, the length is 0 based not starting at 1792.
> The quick hack is to create a new method so the length of the node is correct
>  private static void buildUpMakeUpLong(short[] codes,
> NonLeafLookupTreeNode root)
>    {
>        for (int len = 0, c = codes.length; len < c; len++)
>        {
>            LookupTreeNode leaf = new MakeUpTreeNode((len + 28) * 64);
>            addLookupTreeNode(codes[len], root, leaf);
>        }
>    }
> as thus ...
> buildUpMakeUpLong(LONG_MAKE_UP, WHITE_LOOKUP_TREE_ROOT);
> buildUpMakeUpLong(LONG_MAKE_UP, BLACK_LOOKUP_TREE_ROOT);

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (PDFBOX-1233) CCITTFaxG31DDecodeInputStream - Extended codes have wrong length

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

Andreas Lehmkühler commented on PDFBOX-1233:
--------------------------------------------

Can you provide us with a sample pdf, please?
                
> CCITTFaxG31DDecodeInputStream - Extended codes have wrong length
> ----------------------------------------------------------------
>
>                 Key: PDFBOX-1233
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-1233
>             Project: PDFBox
>          Issue Type: Bug
>            Reporter: Dave Smith
>
> When dealing with large fax images there are Extended Make Up Codes.
> They are added to the tree as ...
> buildUpMakeUp(LONG_MAKE_UP, WHITE_LOOKUP_TREE_ROOT);
> buildUpMakeUp(LONG_MAKE_UP, BLACK_LOOKUP_TREE_ROOT);
> Accept, the length is 0 based not starting at 1792.
> The quick hack is to create a new method so the length of the node is correct
>  private static void buildUpMakeUpLong(short[] codes,
> NonLeafLookupTreeNode root)
>    {
>        for (int len = 0, c = codes.length; len < c; len++)
>        {
>            LookupTreeNode leaf = new MakeUpTreeNode((len + 28) * 64);
>            addLookupTreeNode(codes[len], root, leaf);
>        }
>    }
> as thus ...
> buildUpMakeUpLong(LONG_MAKE_UP, WHITE_LOOKUP_TREE_ROOT);
> buildUpMakeUpLong(LONG_MAKE_UP, BLACK_LOOKUP_TREE_ROOT);

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira