Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compose: Fix iterator for empty tables #434

Merged

Conversation

wismill
Copy link
Member

@wismill wismill commented Jan 16, 2024

The current xkb_compose_table_iterator_next segfaults when used with an empty table. Indeed, in this case we initialize cursors in xkb_compose_table_iterator_new with the dummy node and the direction NODE_LEFT, but the dummy node is a leaf!

Fixed by initializing with no cursors when the table is has no non-dummy nodes.

@wismill wismill added bug Indicates an unexpected problem or unintended behavior compose Indicates a need for improvements or additions to Compose handling labels Jan 16, 2024
@wismill
Copy link
Member Author

wismill commented Jan 16, 2024

Sorry, I do not understand how I could forget to check this…

The current `xkb_compose_table_iterator_next` segfaults when used with an
empty table. Indeed, in this case we initialize cursors in
`xkb_compose_table_iterator_new` with the dummy node and the direction
`NODE_LEFT`, but the dummy node is a leaf!

Fixed by initializing with no cursors when the table is has no non-dummy
nodes.
@wismill wismill force-pushed the compose/fix-iterator-with-empty-table branch from 2a7e89e to c37fb01 Compare January 16, 2024 10:19
@wismill wismill merged commit 43c9752 into xkbcommon:master Jan 16, 2024
4 checks passed
@wismill wismill deleted the compose/fix-iterator-with-empty-table branch January 16, 2024 10:34
@whot
Copy link
Contributor

whot commented Jan 17, 2024

belated 👍 :)

@wismill wismill mentioned this pull request Feb 8, 2024
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior compose Indicates a need for improvements or additions to Compose handling
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants