Skip to content

Cherry pick #112498 to 26.5: Fix segfault reading a Parquet file with an inconsistent bloom filter size - #114574

Merged
robot-ch-test-poll2 merged 4 commits into
backport/26.5/112498from
cherrypick/26.5/112498
Aug 14, 2026
Merged

robot-ch-test-poll2 merged 4 commits into
backport/26.5/112498from
cherrypick/26.5/112498

Conversation

@robot-ch-test-poll2

Copy link
Copy Markdown
Contributor

Original pull-request #112498

Do not merge this PR manually

This pull-request is a first step of an automated backporting.
It contains changes similar to calling git cherry-pick locally.
If you intend to continue backporting the changes, then resolve all conflicts if any.
Otherwise, if you do not want to backport them, then just close this pull-request.

The check results does not matter at this step - you can safely ignore them.

Troubleshooting

If the conflicts were resolved in a wrong way

If this cherry-pick PR is completely screwed by a wrong conflicts resolution, and you want to recreate it:

  • delete the pr-cherrypick label from the PR
  • delete this branch from the repository

You also need to check the Original pull-request for pr-backports-created label, and delete if it's presented there

The PR source

The PR is created in the CI job

tiandiwonder and others added 3 commits July 30, 2026 00:28
… size

`Reader::processBloomFilterHeader` took the bloom filter bitset size from the
file (`BloomFilterHeader.numBytes`, validated only for sign and 32-byte
alignment) and derived the byte range of each 32-byte bloom filter block from
it, without checking that `header_size + numBytes` fits inside the bloom filter
byte range it registered for reading - `ColumnMetaData.bloom_filter_length`, or
the next-known-offset upper bound when the file doesn't record it.

`Prefetcher::splitRange` was the only guard, and it missed the case twice. Its
`length > range.end - start` check underflows when `start > range.end`, and it
only runs while the parent range is still in state `HasRange`: the bloom filter
header and data ranges start at the same offset and the data range is normally
shorter than `min_bytes_for_seek`, so starting the header prefetch coalesces the
data range into the same read task and flips it to `HasTask`, whose tail path
computed `task_offset` unchecked. `Prefetcher::getRangeData` then guarded the
resulting span with `chassert` only, which is compiled out in release builds, so
`findAnyHash` read unmapped memory and the server died with SIGSEGV. When the
out-of-range block landed inside the buffer instead, the row group was pruned on
unrelated bytes and rows went missing silently.

Reject such a header with INCORRECT_DATA, make the `splitRange` checks
underflow-safe and apply them on the coalesced path too, and turn the
`getRangeData` assertion into a real check.

Co-Authored-By: Claude Opus 5 <[email protected]>
00900_long_parquet_load_2 loads every .parquet in data_parquet/ (minus an
EXCLUDE list); this PR adds 04654_bloom_filter_bitset_out_of_bounds.parquet,
which 00900 then also loads, appending rows not in its reference. Exclude the
hand-crafted fixture the same way the other purpose-built data files
(04045/04065/04099) are.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
…ob-read

Fix segfault reading a Parquet file with an inconsistent bloom filter size
@robot-ch-test-poll2 robot-ch-test-poll2 added pr-cherrypick Cherry-pick of merge-commit before backporting. Do not use manually - automated use only! do not test disable testing on pull request pr-bugfix Pull request with bugfix, not backported by default labels Aug 13, 2026
….5-112498

# Conflicts:
#	tests/queries/0_stateless/00900_long_parquet_load_2.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do not test disable testing on pull request pr-bugfix Pull request with bugfix, not backported by default pr-cherrypick Cherry-pick of merge-commit before backporting. Do not use manually - automated use only!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants