Skip to content

fix: Decompressor to return -1 when output doesn't fit#1022

Merged
Tabaie merged 3 commits intomasterfrom
fix/compressor/truncated-input
Jan 26, 2024
Merged

fix: Decompressor to return -1 when output doesn't fit#1022
Tabaie merged 3 commits intomasterfrom
fix/compressor/truncated-input

Conversation

@Tabaie
Copy link
Copy Markdown
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
Copy Markdown
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
@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