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 FastNoiseLite.get_image function crashes Godot #84177

Closed
qarmin opened this issue Oct 30, 2023 · 1 comment · Fixed by #84181
Closed

Executing FastNoiseLite.get_image function crashes Godot #84177

qarmin opened this issue Oct 30, 2023 · 1 comment · Fixed by #84181

Comments

@qarmin
Copy link
Contributor

qarmin commented Oct 30, 2023

Godot version

4.2.beta.custom_build. 9144457

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):
	var temp_variable5311 = FastNoiseLite.new()
	temp_variable5311.disconnect(StringName("5555"), Callable(BoxMesh.new(),""))
	temp_variable5311.get_image(-5, 6, true, false, true)

Godot crashes:

Godot Engine v4.2.beta.custom_build.914445748 - https://godotengine.org
Vulkan API 1.2.0 - Forward+ - Using Vulkan Device #0: Unknown - SwiftShader Device (LLVM 10.0.0)
######################## Ending test ########################
ERROR: Method argument to Callable constructor must be a non-empty string
   at: Callable (core/variant/callable.cpp:348)
ERROR: Cannot disconnect from '5555': the provided callable is null.
   at: _disconnect (core/object/object.cpp:1409)
ERROR: Condition "p_width <= 0 || p_height <= 0 || p_depth <= 0" is true. Returning: Vector<Ref<Image>>()
   at: _get_image (modules/noise/noise.cpp:84)
ERROR: FATAL: Index p_index = 0 is out of bounds (size() = 0).
   at: get (./core/templates/cowdata.h:158)
================================================================
handle_crash: Program crashed with signal 4
Engine version: Godot Engine v4.2.beta.custom_build (9144457484f9d2f53990a0aac37caff1c9012e6d)
Dumping the backtrace. Please include this when reporting the bug to the project developer.
[1] ./godot.linuxbsd.editor.dev.x86_64.san(+0x3a2026b1) [0x5566308c16b1] (/home/runner/work/Qarminer/Qarminer/godot/platform/linuxbsd/crash_handler_linuxbsd.cpp:61)
[2] /lib/x86_64-linux-gnu/libc.so.6(+0x42520) [0x7f5c62c42520] (??:0)
[3] CowData<Ref<Image> >::get(int) const (/home/runner/work/Qarminer/Qarminer/godot/./core/templates/cowdata.h:158 (discriminator 7))
[4] Vector<Ref<Image> >::operator[](int) const (/home/runner/work/Qarminer/Qarminer/godot/./core/templates/vector.h:96)
[5] Noise::get_image(int, int, bool, bool, bool) const (/home/runner/work/Qarminer/Qarminer/godot/modules/noise/noise.cpp:169)
[6] void call_with_variant_args_retc_helper<__UnexistingClass, Ref<Image>, int, int, bool, bool, bool, 0ul, 1ul, 2ul, 3ul, 4ul>(__UnexistingClass*, Ref<Image> (__UnexistingClass::*)(int, int, bool, bool, bool) const, Variant const**, Variant&, Callable::CallError&, IndexSequence<0ul, 1ul, 2ul, 3ul, 4ul>) (/home/runner/work/Qarminer/Qarminer/godot/./core/variant/binder_common.h:806 (discriminator 4))
[7] void call_with_variant_args_retc_dv<__UnexistingClass, Ref<Image>, int, int, bool, bool, bool>(__UnexistingClass*, Ref<Image> (__UnexistingClass::*)(int, int, bool, bool, bool) const, Variant const**, int, Variant&, Callable::CallError&, Vector<Variant> const&) (/home/runner/work/Qarminer/Qarminer/godot/./core/variant/binder_common.h:538)
[8] MethodBindTRC<Ref<Image>, int, int, bool, bool, bool>::call(Object*, Variant const**, int, Callable::CallError&) const (/home/runner/work/Qarminer/Qarminer/godot/./core/object/method_bind.h:583)
[9] Object::callp(StringName const&, Variant const**, int, Callable::CallError&) (/home/runner/work/Qarminer/Qarminer/godot/core/object/object.cpp:774)
[10] Variant::callp(StringName const&, Variant const**, int, Variant&, Callable::CallError&) (/home/runner/work/Qarminer/Qarminer/godot/core/variant/variant_call.cpp:1168)
[11] GDScriptFunction::call(GDScriptInstance*, Variant const**, int, Callable::CallError&, GDScriptFunction::CallState*) (/home/runner/work/Qarminer/Qarminer/godot/modules/gdscript/gdscript_vm.cpp:1705)
[12] GDScriptInstance::callp(StringName const&, Variant const**, int, Callable::CallError&) (/home/runner/work/Qarminer/Qarminer/godot/modules/gdscript/gdscript.cpp:1896)
[13] bool Node::_gdvirtual__process_call<false>(double) (/home/runner/work/Qarminer/Qarminer/godot/scene/main/node.h:318 (discriminator 1))
[14] Node::_notification(int) (/home/runner/work/Qarminer/Qarminer/godot/scene/main/node.cpp:58)
[15] Node::_notificationv(int, bool) (/home/runner/work/Qarminer/Qarminer/godot/./scene/main/node.h:49 (discriminator 14))
[16] Object::notification(int, bool) (/home/runner/work/Qarminer/Qarminer/godot/core/object/object.cpp:839)
[17] SceneTree::_process_group(SceneTree::ProcessGroup*, bool) (/home/runner/work/Qarminer/Qarminer/godot/scene/main/scene_tree.cpp:951)
[18] SceneTree::_process(bool) (/home/runner/work/Qarminer/Qarminer/godot/scene/main/scene_tree.cpp:1023 (discriminator 2))
[19] SceneTree::process(double) (/home/runner/work/Qarminer/Qarminer/godot/scene/main/scene_tree.cpp:510)
[20] Main::iteration() (/home/runner/work/Qarminer/Qarminer/godot/main/main.cpp:3613)
[21] OS_LinuxBSD::run() (/home/runner/work/Qarminer/Qarminer/godot/platform/linuxbsd/os_linuxbsd.cpp:933)
[22] ./godot.linuxbsd.editor.dev.x86_64.san(main+0x58f) [0x5566308c1118] (/home/runner/work/Qarminer/Qarminer/godot/platform/linuxbsd/godot_linuxbsd.cpp:76)
[23] /lib/x86_64-linux-gnu/libc.so.6(+0x29d90) [0x7f5c62c29d90] (??:0)
[24] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x80) [0x7f5c62c29e40] (??:0)
[25] ./godot.linuxbsd.editor.dev.x86_64.san(_start+0x25) [0x5566308c0ac5] (??:?)
-- END OF BACKTRACE --
================================================================
Aborted (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

@jsjtxietian
Copy link
Contributor

Same as #83926, I will fix it and find other places that need some check too.

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

Successfully merging a pull request may close this issue.

3 participants