Piotr Karwasz created IMAGING-408:
-------------------------------------
Summary: ICNS parser throws IllegalArgumentException for a
negative or too small element size
Key: IMAGING-408
URL: https://issues.apache.org/jira/browse/IMAGING-408
Project: Commons Imaging
Issue Type: Bug
Components: Format: ICNS
Affects Versions: 1.0.0-alpha6
Reporter: Piotr Karwasz
{{IcnsImageParser.readIcnsElement}} reads the element size as a signed {{int}}
and only checks that it is not greater than the remaining container size, then
reads {{elementSize - 8}} bytes. An element size of {{0xFFFFFFFF}} is read as
-1, passes the check, and {{BinaryFunctions.readBytes(..., -9, ...)}} fails
with {{IllegalArgumentException: size < 0}}, which escapes
{{Imaging.getBufferedImage}}, {{getImageInfo}} and the other public methods
instead of an {{ImagingException}}. Sizes from 0 to 7 have the same problem.
Suggested fix: reject element sizes smaller than 8 (the size of the element
header) with an {{ImagingException}}.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)