commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Groß (JIRA) <j...@apache.org>
Subject [jira] [Comment Edited] (IMAGING-162) BMP files with negative bitmap height are not supported
Date Sun, 15 Feb 2015 18:12:11 GMT

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

Michael Groß edited comment on IMAGING-162 at 2/15/15 6:11 PM:
---------------------------------------------------------------

[~mgolub] Thank you for the comprehensive information and for the example bitmap! Especially
examples from the wild are very helpful because I can write tests using them. 

I created http://github.com/mgmechanics/commons-imaging/tree/IMAGING-162 to propose a patch
which fixes this issue. First I am adding a test which reproduces the problem. Next I will
fix it by throwing an exception if a bitmap with negative height is provided and leave a TODO
comment on place. Then I will try to read such files without error and change the test accordingly.

Edit: In my patch Image Info is read correct even if height is negative but if you try to
read such an bmp you'll got an ImageReadException which tells:
"Reading image data from bitmaps with negative header is yet not supported."


was (Author: mgmechanics):
[~mgolub] Thank you for the comprehensive information and for the example bitmap! Especially
examples from the wild are very helpful because I can write tests using them. 

I created http://github.com/mgmechanics/commons-imaging/tree/IMAGING-162 to propose a patch
which fixes this issue. First I am adding a test which reproduces the problem. Next I will
fix it by throwing an exception if a bitmap with negative height is provided and leave a TODO
comment on place. Then I will try to read such files without error and change the test accordingly.

> BMP files with negative bitmap height are not supported
> -------------------------------------------------------
>
>                 Key: IMAGING-162
>                 URL: https://issues.apache.org/jira/browse/IMAGING-162
>             Project: Commons Imaging
>          Issue Type: Bug
>          Components: Format: BMP
>    Affects Versions: 1.0
>            Reporter: Myroslav Golub
>             Fix For: Patch Needed
>
>         Attachments: monochrome-negative-height.bmp
>
>
> The BMP format allows for negative values of the height field in the header. This means
that the image lines are stored top-down, not bottom-up as usual (i. e. the first pixel in
the pixel array would be in the top left corner of the image, not in the bottom left as usual).
However, when a negative-height bitmap is passed, the BmpImageParser attempts to create an
array of negative length, and a NegativeArraySizeException ensues.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message