Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tool crashes with large input files in binary mode #8

Open
lukas0820 opened this issue Apr 21, 2022 · 2 comments
Open

tool crashes with large input files in binary mode #8

lukas0820 opened this issue Apr 21, 2022 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@lukas0820
Copy link

The following error occurs when large input files (>2GB) are to be decompressed in binary mode:

Exception in thread "main" java.lang.OutOfMemoryError: Requested array size exceeds VM limit
	at java.util.Arrays.copyOf(Arrays.java:3236)
	at java.io.ByteArrayOutputStream.grow(ByteArrayOutputStream.java:118)
	at java.io.ByteArrayOutputStream.ensureCapacity(ByteArrayOutputStream.java:93)
	at java.io.ByteArrayOutputStream.write(ByteArrayOutputStream.java:135)
	at org.openmainframeproject.tersedecompress.TerseDecompresser.PutChar(TerseDecompresser.java:108)
	at org.openmainframeproject.tersedecompress.NonSpackDecompresser.decode(NonSpackDecompresser.java:81)
	at org.openmainframeproject.tersedecompress.TerseDecompress.process(TerseDecompress.java:104)
	at org.openmainframeproject.tersedecompress.TerseDecompress.main(TerseDecompress.java:113)

The problem can be fixed by limiting the maximum record size in PutChar(TerseDecompresser.java:108):

record.write(X-1);  
final int MAX_ARRAY_SIZE = Integer.MAX_VALUE - 10;  
if (record.size() >= MAX_ARRAY_SIZE) {  
   endRecord();  
}
@jmertic
Copy link
Member

jmertic commented Mar 1, 2023

Hi! This project is in Emeritus status and no longer maintained. If you would like to help maintain this let us know. Also - please submit your change as a PR. Thanks!

@jmertic jmertic closed this as completed Mar 1, 2023
@jmertic jmertic reopened this Apr 13, 2023
@alexgubanow alexgubanow added the bug Something isn't working label Jul 6, 2023
@alexgubanow alexgubanow self-assigned this Jul 6, 2023
@alexgubanow
Copy link

hey @lukas0820 , could you test the change with your file. please use this branch https://github.com/openmainframeproject/tersedecompress/tree/8-tool-crashes-with-large-input-files-in-binary-mode

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

3 participants