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: Decompressor to return -1 when output doesn't fit #1022

Merged
merged 3 commits into from
Jan 26, 2024

Conversation

Tabaie
Copy link
Contributor

@Tabaie Tabaie commented Jan 26, 2024

Description

Currently, when the output buffer d is not long enough to contain the decompressed stream, Decompress returns dLength = 0 which is seen as a valid output. This PR changes that to -1 which in any cryptographic prime-order field is so large it cannot be confused with a valid output length.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How has this been tested?

TestOutBufTooShort

How has this been benchmarked?

No benchmark. Performance impact expected to be negligible.

Checklist:

  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • I did not modify files generated from templates
  • golangci-lint does not output errors locally
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

Copy link
Collaborator

@AlexandreBelling AlexandreBelling left a comment

Choose a reason for hiding this comment

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

Looking good to me :)

@Tabaie Tabaie merged commit 179023d into master Jan 26, 2024
7 checks passed
@Tabaie Tabaie deleted the fix/compressor/truncated-input branch January 26, 2024 17:13
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