Skip to content

fix: align constrained INTEGER length encoding with decoder#13

Merged
Alonza0314 merged 1 commit into
free5gc:mainfrom
roundspring2003:fix/integer-length-encoding
Mar 31, 2026
Merged

fix: align constrained INTEGER length encoding with decoder#13
Alonza0314 merged 1 commit into
free5gc:mainfrom
roundspring2003:fix/integer-length-encoding

Conversation

@roundspring2003

@roundspring2003 roundspring2003 commented Mar 25, 2026

Copy link
Copy Markdown
Contributor

Summary

Testing

  • go test ./...

@roundspring2003

Copy link
Copy Markdown
Contributor Author

@Alonza0314 Test all pass

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes aligned PER constrained INTEGER length determinant encoding for value ranges greater than 65536 by aligning the encoder’s byte-length calculation with the decoder’s logic (issue #12), and adds regression tests to prevent reintroducing the mismatch.

Changes:

  • Fix appendInteger byte-length calculation for valueRange > 65536 by breaking only when the shifted range becomes zero.
  • Add regression tests covering two previously failing constrained ranges and validate both exact bytes and Marshal/Unmarshal round-trip.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
marshal.go Adjusts constrained INTEGER length determinant byte-length calculation to match decoder behavior for large ranges.
aper_test.go Adds regression tests verifying correct encoded bytes and successful round-trip decoding for affected ranges.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Alonza0314 Alonza0314 merged commit 9aca241 into free5gc:main Mar 31, 2026
6 checks passed
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.

3 participants