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

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

Commit 1941381 from Maruan Sahyoun in branch 'pdfbox/branches/3.0'
[ https://svn.apache.org/r1941381 ]

PDFBOX-6384: Calculate the predictor row length without int overflow

Co-Authored-By: Claude <[email protected]>

> Calculate the predictor row length without int overflow
> -------------------------------------------------------
>
>                 Key: PDFBOX-6384
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-6384
>             Project: PDFBox
>          Issue Type: Bug
>    Affects Versions: 2.0.37, 3.0.8 PDFBox, 4.0.0
>            Reporter: Maruan Sahyoun
>            Assignee: Maruan Sahyoun
>            Priority: Minor
>              Labels: Predictor
>             Fix For: 2.0.38, 3.0.9 PDFBox, 4.0.0
>
>
> This is a follow-up to PDFBOX-6265, which limited the row length for 
> predictor decoding.
> The row length is calculated as `int` from `/Colors`, `/BitsPerComponent` and 
> `/Columns` in the decode parameters. Large values can overflow, e.g. 
> `/Columns 536870913` with 8 bits per pixel results in a row length of 1, 
> which passes the checks for non-positive row lengths and for the maximum row 
> length. Negative `/Colors` and `/BitsPerComponent` give a positive product as 
> well. Decoding then works with parameters that don't match the row buffers, 
> and can end with an `ArrayIndexOutOfBoundsException` instead of an 
> `IOException`.
> Proposed change
>  - Calculate the predictor row length as `long`, and treat non-positive 
> colors, bits per component or columns as a row length of 0, which is rejected
>  - Check the row length against the maximum before converting it to `int`
>  - Add tests for the maximum row length, an overflowing row length and 
> negative parameters
> Thanks to Gjoko Krstikj (ING) for the report.
> Claude on behalf of Maruan Sahyoun (msahyoun)



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