Skip to content

fix(influxdb3_catalog): guard payload_len against integer overflow#27508

Open
naruto-lgtm wants to merge 1 commit into
influxdata:mainfrom
naruto-lgtm:catalog-payload-len-overflow
Open

fix(influxdb3_catalog): guard payload_len against integer overflow#27508
naruto-lgtm wants to merge 1 commit into
influxdata:mainfrom
naruto-lgtm:catalog-payload-len-overflow

Conversation

@naruto-lgtm

Copy link
Copy Markdown

Repro: parse a catalog log or snapshot whose header payload_len is set near u64::MAX.
Cause: read_inner computes pos + payload_len before the buffer-length check, so the usize add overflows and the wrapped value passes the check; slicing the payload then indexes out of range and panics.
Fix: compute the end offset with checked_add and reject an overflowing or oversized length as BufferTooShort, the same outcome the reader already gives a truncated file.

  • I've read the contributing section of the project README.
  • Signed CLA (if not already signed).

A crafted or corrupt catalog file can set the header payload_len near u64::MAX, overflowing pos + payload_len so the wrapped offset slips past the buffer-length check and the payload slice then panics on an out-of-range index. Use checked_add and reject an out-of-range length as BufferTooShort, matching the reader's existing truncated-file path.
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