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

Fix encode/decode out calculations #48

Closed
05nelsonm opened this issue Jan 20, 2023 · 1 comment · Fixed by #52
Closed

Fix encode/decode out calculations #48

05nelsonm opened this issue Jan 20, 2023 · 1 comment · Fixed by #52
Labels
bug Something isn't working

Comments

@05nelsonm
Copy link
Owner

05nelsonm commented Jan 20, 2023

  1. The EncoderDecoder.Config methods for pre-calculating the encoded and decoded out size should accept a Long instead of Int, and return a Long
  2. decodeOutMaxSizeOrFail should accept null for input to be usable with streams.
    3. A stream won't have access to the entirety of what is being decoded and thus, cannot send DecoderInput.
  3. DecoderInput should check for a negative return value of decodeOutMaxSizeOrFail and throw EncodingException
  4. DecoderInput should check if the returned Long is greater than Int.MAX_VALUE and throw EncodingException

There's a possibility of the EncoderDecoder.Config implementation having an overflow issue, that should be checked for in the base abstraction and throw such that we can guarantee a positive value is always returned.

@05nelsonm 05nelsonm added the bug Something isn't working label Jan 20, 2023
@05nelsonm
Copy link
Owner Author

The encodeOutSize and decodeOutMaxSizeOrFail methods should throw some sort of overflow exception if the number is greater than Long.MAX_VALUE. Think a new exception here that inherits from EncodingException would be best, in order to be specific.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant