commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Groß (JIRA) <>
Subject [jira] [Commented] (IMAGING-162) BMP files with negative bitmap height are not supported
Date Sat, 21 Feb 2015 15:52:15 GMT


Michael Groß commented on IMAGING-162:

I created the PRs on github for this and also for the other patches I that I propose.

This proposed patch works yet (as date of writing) only for BMPs which are not RLE encoded.
I didn't touch the code for RLE encoded BMPs yet, nor i did execute some specific tests for
this format. (But I am working on it).

A word about the test cases: All existing tests seems to executed in a big loop over all available
test images. Each test class is executed for the images wich fitting type, i.e. BMP test clases
for BMPs. This is good to see if a particular image raises some exceptions in the code, but
it does not allow to create specific tests i.e. asserting if the pixels of a BMP with negative
height are read as expected or if a broken image file throws a certain exception.

There fore I added the package *org.apache.commons.imaging.formats.bmp.specific* to have such
tests for BMPs here. They aren't executed by the "big loop" described before thus they are
independed from what images are in *src/test/data/images*. Accordingly I added  *src/test/data/specificTests*
for image examples which are not used in the "big loop".

So I would propose that when we want to fix an issue like this we first add example images
to *src/test/data/specificTests* and add tests which reproduces the problem to a package called

> BMP files with negative bitmap height are not supported
> -------------------------------------------------------
>                 Key: IMAGING-162
>                 URL:
>             Project: Commons Imaging
>          Issue Type: Bug
>          Components: Format: BMP
>    Affects Versions: 1.0
>            Reporter: Myroslav Golub
>              Labels: github
>             Fix For: Review Patch
>         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

View raw message