You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I expect small files to use a small amount of memory. However, oss-fuzz finds the attached small file can trigger an out of memory error, using 2584mb of RAM.
Steps to reproduce the problem.
I've attempted to simplify the reproduction, and here is what I've come up with. It has the file as an array of integers, but it comes from the zip embedded below.
If you have any thoughts about why there is a large amount of memory being used, or if you think it's reasonable that an 87 byte file can use that much memory, please let me know. Thanks
The text was updated successfully, but these errors were encountered:
This issue is a design one. The library pre-allocates precints and codeblocks related structures, such as tagtree, for a whole tile. In the case of POC, there are for example 37 million codeblocks for one precinct, which represents 4 GB of RAM for the codeblock working memory (and other GB for tagtree etc). Completely legit JPEG2000 images could be built with the same characteristics as those corrupted images, and with sufficient huge amount of RAM could be docoded. As fixing the design of openjpeg would be enormous work, a fix would probably to set some implementation-defined thresholds, not normally reached on "normal" images, and error out if they are reached, and let the user able to override them with some environment variable.
Could this problem at least be mitigated by raising an error if the user data does not have a minimum length needed to expand to the image size?
Or when strict mode is enabled, could an error be raised early since there needs to be an EOC marker, and there isn't one in this file?
Expected behavior and actual behavior.
I expect small files to use a small amount of memory. However, oss-fuzz finds the attached small file can trigger an out of memory error, using 2584mb of RAM.
Steps to reproduce the problem.
I've attempted to simplify the reproduction, and here is what I've come up with. It has the file as an array of integers, but it comes from the zip embedded below.
image.zip
Operating system
Ubuntu 20.04
openjpeg version
2.5.3
If you have any thoughts about why there is a large amount of memory being used, or if you think it's reasonable that an 87 byte file can use that much memory, please let me know. Thanks
The text was updated successfully, but these errors were encountered: