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

Exception in checksum verification in ArmoredInputStream is sometimes swallowed #998

Closed
vanitasvitae opened this issue Jul 26, 2021 · 1 comment

Comments

@vanitasvitae
Copy link
Contributor

Hey!

The ArmoredInputStream does a checksum verification in its read() method.
Unfortunately, a mismatching CRC checksum results in an IOException being thrown.

This is unfortunate, because the default implementation of InputStream.read(bytes, offset, length) silently swallows IOExceptions. Therefore the CRC checksum error goes unnoticed.

I see two ways of fixing this:

  1. Throw a custom exception not derived from IOException. This will likely break existing implementations, as a new runtime exception type needs to be introduced.
  2. Override ArmoredInputStream.read(bytes, offset, length) to not swallow IOExceptions. This is probably the preferred way to solve the issue.

See pgpainless/pgpainless#159 (comment)

@dghgit
Copy link
Contributor

dghgit commented Nov 26, 2021

Closing as #999 now merged.

@dghgit dghgit closed this as completed Nov 26, 2021
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

No branches or pull requests

2 participants