Skip to content

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

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

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

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

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:29
metux pushed a commit that referenced this pull request May 18, 2026
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