Skip to content

Refactor encoding replicated stream messages to properly enforce framing#6052

Merged
derekcollison merged 1 commit intomainfrom
neil/encodestreammsg
Oct 29, 2024
Merged

Refactor encoding replicated stream messages to properly enforce framing#6052
derekcollison merged 1 commit intomainfrom
neil/encodestreammsg

Conversation

@neilalexander
Copy link
Copy Markdown
Member

This PR fixes two bugs in encodeStreamMsgAllowCompress:

  • The boundary lengths could have overflowed when casting potentially large values down to uint16 or uint32 and we wouldn't have noticed;
  • We would then copy in the subject/reply/header/msg with the original length regardless, not the overflowed length, meaning the decoding side would have the wrong boundaries.

Now we will correctly calculate the bounds, avoiding overflows, and only append as many bytes as we clipped down to.

Signed-off-by: Neil Twigg neil@nats.io

@neilalexander neilalexander marked this pull request as ready for review October 29, 2024 10:55
@neilalexander neilalexander requested a review from a team as a code owner October 29, 2024 10:55
@derekcollison derekcollison self-requested a review October 29, 2024 11:16
Copy link
Copy Markdown
Member

@derekcollison derekcollison left a comment

Choose a reason for hiding this comment

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

LGTM

@derekcollison derekcollison merged commit 06e5aa2 into main Oct 29, 2024
@derekcollison derekcollison deleted the neil/encodestreammsg branch October 29, 2024 11:58
neilalexander added a commit that referenced this pull request Oct 29, 2024
Includes the following:

- #5115
- #6019
- #6039
- #6034
- #6043
- #6042
- #6047
- #6049
- #6050 
- #6052
- #6053

Signed-off-by: Neil Twigg <neil@nats.io>
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