Open Col-E opened 2 years ago
Another recent case:
java.lang.IllegalArgumentException: newLimit < 0: (-10 < 0)
at java.base/java.nio.Buffer.createLimitException(Buffer.java:395)
at java.base/java.nio.Buffer.limit(Buffer.java:369)
at java.base/java.nio.ByteBuffer.limit(ByteBuffer.java:1529)
at java.base/java.nio.ByteBuffer.limit(ByteBuffer.java:267)
at software.coley.lljzip.util.ByteDataUtil.sliceExact(ByteDataUtil.java:302)
at software.coley.lljzip.util.BufferData.slice(BufferData.java:83)
at software.coley.lljzip.util.ByteData.sliceOf(ByteData.java:108)
at software.coley.lljzip.util.ByteDataUtil.lambda$readLazyLongSlice$7(ByteDataUtil.java:508)
at software.coley.lljzip.util.lazy.LazyByteData.get(LazyByteData.java:49)
Error provided by user. It would be ideal to have each ByteData
be assigned a label and to rethrow errors to contain that label so we can have some idea of where the issue comes from when we are not provided with a sample.
For a sample: https://github.com/Col-E/Recaf/issues/373
Essentially, if the input isn't parsable ensure the reason why is clearly described in a thrown exception. Allows the library user to handle invalid files easily without having to check for themselves.