-
Notifications
You must be signed in to change notification settings - Fork 250
Closed
Description
In SnappyInputStream, OutOfMemoryError is used to validate the buffer size to allocated.
snappy-java/src/main/java/org/xerial/snappy/SnappyInputStream.java
Lines 451 to 456 in dfbf67a
| try { | |
| compressed = new byte[chunkSize]; | |
| } | |
| catch (java.lang.OutOfMemoryError e) { | |
| throw new SnappyError(SnappyErrorCode.INVALID_CHUNK_SIZE, e.getMessage()); | |
| } |
This's a bad way to validate buffer size as explain here.
And another serious consequence, catching OutOfMemoryError in Java code requires the applications not to use JVM options like CrashOnOutOfMemoryError or ExitOnOutOfMemoryError to automatically restart the JVM when it runs out of memory.
I'm wondering if there is a specific reason why that could not be a simple conditional validation?
btd
Metadata
Metadata
Assignees
Labels
No labels