[fix](be) Validate dictionary page codes - #66832
Open
YanzhiJin5 wants to merge 1 commit into
Open
Conversation
YanzhiJin5
requested review from
airborne12,
csun5285,
eldenmoon,
gavinchou,
liaoxin01 and
yiguolei
as code owners
August 17, 2026 06:57
Contributor
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
Author
|
run buildall |
Author
|
/review |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What problem does this PR solve?
Issue Number: #63609
Related PR: N/A
Problem Summary:
Persisted dictionary pages may contain invalid signed
int32_tdictionary codes.BinaryDictPageDecoderpreviously allowed negative or out-of-range codes to reach downstream dictionary handling without enforcing:This could expose invalid dictionary state to downstream consumers instead of returning a corruption error at the storage decoding boundary.
This PR validates decoded dictionary codes before they become caller-visible:
next_batch()validates the complete decoded batch before inserting normal dictionary output, resolvingonly_read_offsets, updating*n, or advancing the decoder cursor.read_by_rowids()gathers and validates all selected codes before producing caller-visible output or updating*n.Status::Corruption.The regression test covers:
-1);dictionary_size;next_batch();read_by_rowids();only_read_offsets;The regression test was verified RED → GREEN: it fails without the production validation and passes after the validation is restored.
ASAN unit test:
BUILD_TYPE_UT=ASAN ./run-be-ut.sh --run -j2 \ --filter='BinaryDictPageTest.RejectInvalidDictionaryCodes'Result: PASS, 1/1.
Additional checks:
build-support/clang-format.sh: PASSbuild-support/check-format.sh: PASSgit diff --check origin/master...HEAD: PASSThe validation adds one additional sequential O(n) pass over decoded dictionary codes for valid data. No directly applicable
BinaryDictPageDecoderbenchmark is currently available, so the performance impact has not been quantitatively established.This addresses a matching dictionary-decoder robustness issue found while investigating the reported crash. The original production segment was not available for exact reproduction, so this PR does not claim reproduction of the exact production crash.
Release note
None
Check List (For Author)
Test
Regression test
Unit Test
Manual test (add detailed scripts or steps below)
No need to test or manual test. Explain why:
Behavior changed:
Status::Corruptionat the decoder boundary instead of being propagated to downstream dictionary handling.Does this need documentation?
Check List (For Reviewer who merge this PR)