Skip to content

(release/25.1) xkb: Fix off-by-one and NULL dereferences in _CheckSetOverlay()#2795

Open
metux wants to merge 1 commit into
release/25.1from
pr/release/25.1-xkb-fix-off-by-one-and-null-dereferences-in-checksetoverlay-_2026-05-18_20-28-39
Open

(release/25.1) xkb: Fix off-by-one and NULL dereferences in _CheckSetOverlay()#2795
metux wants to merge 1 commit into
release/25.1from
pr/release/25.1-xkb-fix-off-by-one-and-null-dereferences-in-checksetoverlay-_2026-05-18_20-28-39

Conversation

@metux
Copy link
Copy Markdown
Contributor

@metux metux commented May 18, 2026

Off-by-one in rowUnder validation: the bounds check uses '>' instead
of '>=' when comparing rWire->rowUnder against section->num_rows.
Since num_rows is a count and valid indices are 0 to num_rows-1,
rowUnder == num_rows passes the check but is one past the valid range.
XkbAddGeomOverlayRow() uses this as an array index, causing an
out-of-bounds read on section->rows[].

And throw in two alloc checks while we're at it.

Assisted-by: Claude:claude-claude-opus-4-6
Part-of: https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2208

@metux metux self-assigned this May 18, 2026
@metux metux requested a review from a team May 18, 2026 18:28
metux pushed a commit that referenced this pull request May 18, 2026
Off-by-one in rowUnder validation: the bounds check uses '>' instead
of '>=' when comparing rWire->rowUnder against section->num_rows.
Since num_rows is a count and valid indices are 0 to num_rows-1,
rowUnder == num_rows passes the check but is one past the valid range.
XkbAddGeomOverlayRow() uses this as an array index, causing an
out-of-bounds read on section->rows[].

And throw in two alloc checks while we're at it.

Assisted-by: Claude:claude-claude-opus-4-6
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2208>
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
@metux metux force-pushed the pr/release/25.1-xkb-fix-off-by-one-and-null-dereferences-in-checksetoverlay-_2026-05-18_20-28-39 branch from e88472f to 0423220 Compare May 19, 2026 17:15
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.

2 participants