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

Prevent JVM crash when buffer too small #140

Conversation

findepi
Copy link
Contributor

@findepi findepi commented Apr 12, 2022

Extracted from #142

@findepi findepi requested a review from martint April 12, 2022 10:36
@findepi findepi force-pushed the findepi/prevent-jvm-crash-when-buffer-too-small-82cd0a branch 2 times, most recently from 8d6596b to a03c8a7 Compare April 12, 2022 16:13
The test was passing incorrect value for `maxOutputLength`.
@findepi findepi force-pushed the findepi/prevent-jvm-crash-when-buffer-too-small-82cd0a branch from a03c8a7 to 89892d7 Compare April 12, 2022 16:23
// mis-declared buffer size
byte[] compressedChoppedOff = Arrays.copyOf(compressed, compressedLength - 1);
throwable = catchThrowable(() -> decompressor.decompress(compressedChoppedOff, 0, compressedLength, data, 0, data.length));
if (throwable instanceof UncheckedIOException) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Who throws this exception? In general, there shouldn’t be any IO related exceptions involved.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GZIP code under the hood, AFAIR

(the expected exceptions are "whatever is looks somewhat reasonable", the fact that there is an exception is the most important part)

@findepi findepi merged commit 127b7f3 into airlift:master Apr 12, 2022
@findepi findepi deleted the findepi/prevent-jvm-crash-when-buffer-too-small-82cd0a branch April 12, 2022 19:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants