Skip to content

Prevent payload corruption on buffer overflow - #329

Merged
vickenty merged 2 commits into
masterfrom
vickenty/dhcr
Aug 12, 2026
Merged

Prevent payload corruption on buffer overflow#329
vickenty merged 2 commits into
masterfrom
vickenty/dhcr

Conversation

@vickenty

Copy link
Copy Markdown
Contributor

If caller tries to serialize a metric larger than the payload size limit, we throw BufferOverflow exception, and the user is requested to call resetMetric. Previously, it failed to correctly rewind everything, in particular interners and delta encoders, to the state they had prior to the errant metric, and subsequent entries using dictionary elements of the failed metric would produce dangling references.

This patch adds commit/revert methods to Interner and DeltaEncoder. When the record in progress is added to the final payload, we make the state of inerner and encoder permanent. On failure, revert resets to the last committed state.

If caller tries to serialize a metric larger than the payload size
limit, we throw BufferOverflow exception, and the user is requested to
call `resetMetric`. Previously, it failed to correctly rewind
everything, in particular interners and delta encoders, to the state
they had prior to the errant metric, and subsequent entries using
dictionary elements of the failed metric would produce dangling
references.

This patch adds commit/revert methods to Interner and
DeltaEncoder. When the record in progress is added to the final
payload, we make the state of inerner and encoder permanent. On
failure, revert resets to the last committed state.
@vickenty
vickenty marked this pull request as ready for review August 12, 2026 08:57
@vickenty
vickenty requested a review from a team as a code owner August 12, 2026 08:57
@vickenty
vickenty merged commit 179cda2 into master Aug 12, 2026
21 checks passed
@vickenty
vickenty deleted the vickenty/dhcr branch August 12, 2026 10:52
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