Skip to content

[KIP-932] Reject out-of-range AcquiredRecords in share fetch reply - #5532

Open
Kartik (sage-mode-hunter) wants to merge 1 commit into
confluentinc:masterfrom
sage-mode-hunter:share-fetch-acquired-range
Open

[KIP-932] Reject out-of-range AcquiredRecords in share fetch reply#5532
Kartik (sage-mode-hunter) wants to merge 1 commit into
confluentinc:masterfrom
sage-mode-hunter:share-fetch-acquired-range

Conversation

@sage-mode-hunter

Copy link
Copy Markdown

A broker-supplied AcquiredRecords range in a ShareFetch response can overflow the per-entry ack-type buffer:

  • rd_kafka_share_fetch_reply_handle_partition reads FirstOffset/LastOffset off the wire and computes size = LastOffset - FirstOffset + 1 as int64
  • size is truncated to int32 for types_cnt in rd_kafka_share_ack_batch_entry_new, which allocates entry->types with the truncated count, while the loop that fills entry->types iterates the full int64 size
  • a range wider than INT32_MAX (e.g. FirstOffset 0, LastOffset 2^32) allocates one element then writes 2^32 of them past it; a negative range (LastOffset < FirstOffset) is also accepted today

Guard the range before allocating, in line with the other broker-input validation in this parser.

@sage-mode-hunter
Kartik (sage-mode-hunter) requested a review from a team as a code owner June 24, 2026 15:24
@confluent-cla-assistant

Copy link
Copy Markdown

Please sign the Contributor License Agreement here before this PR can be approved.
❌ sage-mode-hunter
Please push an empty commit if you would like to re-run the checks to verify CLA status for all contributors.

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.

1 participant