[
https://issues.apache.org/jira/browse/IMAGING-279?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17293563#comment-17293563
]
Fabian Meumertzheim commented on IMAGING-279:
---------------------------------------------
The attached BMP gives me the following stack trace when loaded via
new BmpImageParser().getBufferedImage(new ByteSourceArray(input), new
HashMap<>());
java.lang.NegativeArraySizeException: -938762240
at
org.apache.commons.imaging.common.BinaryFunctions.readBytes(BinaryFunctions.java:91)
at
org.apache.commons.imaging.formats.bmp.BmpImageParser.readImageContents(BmpImageParser.java:451)
at
org.apache.commons.imaging.formats.bmp.BmpImageParser.getBufferedImage(BmpImageParser.java:662)
at
org.apache.commons.imaging.formats.bmp.BmpImageParser.getBufferedImage(BmpImageParser.java:643)
!negative_array_size_exception.bmp!
> Array sizes not checked for overflow in BmpImageParser
> ------------------------------------------------------
>
> Key: IMAGING-279
> URL: https://issues.apache.org/jira/browse/IMAGING-279
> Project: Commons Imaging
> Issue Type: Bug
> Components: Format: BMP
> Affects Versions: 1.0-alpha2
> Reporter: Fabian Meumertzheim
> Assignee: Bruno P. Kinoshita
> Priority: Major
> Fix For: 1.0-alpha3
>
> Attachments: negative_array_size_exception.bmp
>
> Time Spent: 20m
> Remaining Estimate: 0h
>
> In BmpImageParser.readImageContents, it is not verified that
> [imageDataSize|https://gitbox.apache.org/repos/asf?p=commons-imaging.git;a=blob;f=src/main/java/org/apache/commons/imaging/formats/bmp/BmpImageParser.java;h=09d560011ebbde5ea8df65a30ea9692c2e697d17;hb=HEAD#l441]
> does not overflow. If it does, BinaryFunctions.readBytes crashes with an
> uncaught NegativeArraySizeException.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)