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

Executing PopupMenu.activate_item_by_event function crashes Godot #84692

Closed
qarmin opened this issue Nov 10, 2023 · 1 comment · Fixed by #87967 or #85477
Closed

Executing PopupMenu.activate_item_by_event function crashes Godot #84692

qarmin opened this issue Nov 10, 2023 · 1 comment · Fixed by #87967 or #85477

Comments

@qarmin
Copy link
Contributor

qarmin commented Nov 10, 2023

Godot version

4.2.beta.custom_build. 9df6491

System information

Ubuntu 22.04 CI

Issue description

When executing (this code was automatically minimized, so it is possible, that an even more "minimal" project can be created)

extends Node
func _process(delta):
	for i in get_children():
		i.queue_free()
	var temp_variable29522 = CodeHighlighter.new()
	temp_variable29522.clear_member_keyword_colors()
	var temp_variable29574 = GLTFBufferView.new()
	var temp_variable29766 = PopupMenu.new()
	add_child(temp_variable29766)
	temp_variable29766.get_item_icon_max_width(-63)
	temp_variable29766.get_item_shortcut(11)
	temp_variable29766.set_item_count(49)
	temp_variable29766.set_item_submenu(11, ".")
	temp_variable29766.activate_item_by_event(InputEventAction.new(), false)

Godot crashes:

Godot Engine v4.2.beta.custom_build.9df649185 - https://godotengine.org
Vulkan API 1.2.0 - Forward+ - Using Vulkan Device #0: Unknown - SwiftShader Device (LLVM 10.0.0)
ERROR: Index p_idx = -63 is out of bounds (items.size() = 0).
   at: get_item_icon_max_width (scene/gui/popup_menu.cpp:1813)
ERROR: Index p_idx = 11 is out of bounds (items.size() = 0).
   at: get_item_shortcut (scene/gui/popup_menu.cpp:1868)
Segmentation fault (core dumped)

This example was found by Godot fuzzer - Qarminer, so it is quite unlikelly that this code could be used in real project, but still this should be handled gracefully.

Memory leaks or asan backtraces are visible when using Godot build with sanitizers support - https://github.com/qarmin/GodotBuilds/actions (linux -> linux-editor-sanitizers)

Steps to reproduce

Above

Minimal reproduction project

Above

@VSofficial
Copy link

I'll replicate the crash on Mac, to see if it is crashing on other platforms too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants