Skip to content

Prevent JVM crash when buffer too small - #140

Merged
findepi merged 3 commits into
airlift:masterfrom
findepi:findepi/prevent-jvm-crash-when-buffer-too-small-82cd0a
Apr 12, 2022
Merged

Prevent JVM crash when buffer too small#140
findepi merged 3 commits into
airlift:masterfrom
findepi:findepi/prevent-jvm-crash-when-buffer-too-small-82cd0a

Conversation

@findepi

@findepi findepi commented Apr 12, 2022

Copy link
Copy Markdown
Contributor

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
findepi added 2 commits April 12, 2022 18:23
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
Copy Markdown
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
Copy Markdown
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