Repository navigation
MDEV-40794: Dynamic Column Aggregate Name Pool Overflow - #6290
Open
immortal-jelly wants to merge 1 commit into
Open
immortal-jelly wants to merge 1 commit into
immortal-jelly wants to merge 1 commit into
Conversation
Author
|
Rebased to 10.11 as requested. Superseding #6238. |
The named dynamic-column format serializes the aggregate name-pool size and every name offset in two bytes (max 65535 = MAX_TOTAL_NAME_LENGTH). calc_var_sizes() accumulated the total name length in size_t without checking against MAX_TOTAL_NAME_LENGTH. When the aggregate exceeded 65535, set_fixed_header_named() truncated the size via int2store() and put_header_entry_named() truncated each offset, producing a malformed blob. In Debug builds the DBUG_ASSERT in put_header_entry_named() aborted the server; in Release builds the malformed blob was silently returned, and a fresh reader saw the wrapped name-pool size causing COLUMN_CHECK to fail and COLUMN_LIST/COLUMN_JSON to reject the object. Fix: add an aggregate name-pool length check in dynamic_new_column_store() (after individual name checks via check_limit_named()) and in dynamic_column_update_many_fmt() (update path). Both return ER_DYNCOL_LIMIT when the total exceeds MAX_TOTAL_NAME_LENGTH. Any authenticated user can trigger this with a plain SET statement (COLUMN_CREATE with multiple names whose total length exceeds 65535), requiring no table, database, or administrative privileges.
immortal-jelly
force-pushed
the
mdev-40794-github-pr
branch
from
December 1, 2026 04:02
58611e1 to
32b2287
Compare
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.
The named dynamic-column format serializes the aggregate name-pool size and every name offset in two bytes (max 65535 = MAX_TOTAL_NAME_LENGTH). calc_var_sizes() accumulated the total name length in size_t without checking against MAX_TOTAL_NAME_LENGTH. When the aggregate exceeded 65535, set_fixed_header_named() truncated the size via int2store() and put_header_entry_named() truncated each offset, producing a malformed blob. In Debug builds the DBUG_ASSERT in put_header_entry_named() aborted the server; in Release builds the malformed blob was silently returned, and a fresh reader saw the wrapped name-pool size causing COLUMN_CHECK to fail and COLUMN_LIST/COLUMN_JSON to reject the object.
Fix: add an aggregate name-pool length check in dynamic_new_column_store() (after individual name checks via check_limit_named()) and in dynamic_column_update_many_fmt() (update path). Both return ER_DYNCOL_LIMIT when the total exceeds MAX_TOTAL_NAME_LENGTH.
Any authenticated user can trigger this with a plain SET statement (COLUMN_CREATE with multiple names whose total length exceeds 65535), requiring no table, database, or administrative privileges.