]> git.mdlowis.com Git - proto/labwc.git/commit
menu: fix use-after-free at exit with sub-menu selected
authorJohn Lindgren <john@jlindgren.net>
Fri, 15 Aug 2025 05:29:15 +0000 (01:29 -0400)
committerHiroaki Yamamoto <hrak1529@gmail.com>
Fri, 15 Aug 2025 09:46:34 +0000 (18:46 +0900)
commitd9f7ccf3aa256a133fa4f2b62d19a473435ae621
tree61d706081147253d9011effb91040081932fd7d2
parent6e949e623a14349f7a61f44e0872a14b0a8b71da
menu: fix use-after-free at exit with sub-menu selected

Sequence of events:

- menu_finish() frees the sub-menu first
- the selection.menu of the parent menu is now dangling
- menu_finish() frees the parent menu
- menu_free() calls menu_close_root() on the parent menu
- menu_close_root() tries to close the (freed) sub-menu
- boom

Extending nullify_item_pointing_to_this_menu() avoids the crash.
src/menu/menu.c