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_seamless_image function crashes Godot #83926

Closed
qarmin opened this issue Oct 25, 2023 · 0 comments · Fixed by #83978
Closed

Executing FastNoiseLite.get_seamless_image function crashes Godot #83926

qarmin opened this issue Oct 25, 2023 · 0 comments · Fixed by #83978

Comments

@qarmin
Copy link
Contributor

qarmin commented Oct 25, 2023

Godot version

v4.2.beta.custom_build. e8d57af

System information

Ubuntu 22.04 CI

Issue description

When executing

extends Node
func _process(delta):
	var temp_variable5302 = FastNoiseLite.new()
	temp_variable5302.set_cellular_jitter(0.66172504425049)
	temp_variable5302.get_seamless_image(-7, 4, false, false, -1.64324378967285, false)

Godot crashes:

Godot Engine v4.2.beta.custom_build.e8d57afae - https://godotengine.org
Vulkan API 1.2.0 - Forward+ - Using Vulkan Device #0: Unknown - SwiftShader Device (LLVM 10.0.0)

ERROR: Condition "p_width <= 0 || p_height <= 0 || p_depth <= 0" is true. Returning: Vector<Ref<Image>>()
   at: _get_seamless_image (modules/noise/noise.cpp:36)
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 (e8d57afaeccf0d9f9726746f49936eb93aa0039b)
Dumping the backtrace. Please include this when reporting the bug to the project developer.
[1] ./godot.linuxbsd.editor.dev.x86_64.san(+0x3a1be2f1) [0x55858bb832f1] (/home/runner/work/Qarminer/Qarminer/godot/platform/linuxbsd/crash_handler_linuxbsd.cpp:61)
[2] /lib/x86_64-linux-gnu/libc.so.6(+0x42520) [0x7fd276e42520] (??: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_seamless_image(int, int, bool, bool, float, bool) const (/home/runner/work/Qarminer/Qarminer/godot/modules/noise/noise.cpp:57)
[6] void call_with_variant_args_retc_helper<__UnexistingClass, Ref<Image>, int, int, bool, bool, float, bool, 0ul, 1ul, 2ul, 3ul, 4ul, 5ul>(__UnexistingClass*, Ref<Image> (__UnexistingClass::*)(int, int, bool, bool, float, bool) const, Variant const**, Variant&, Callable::CallError&, IndexSequence<0ul, 1ul, 2ul, 3ul, 4ul, 5ul>) (/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, float, bool>(__UnexistingClass*, Ref<Image> (__UnexistingClass::*)(int, int, bool, bool, float, 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, float, 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:1697)
[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) [0x55858bb82d58] (/home/runner/work/Qarminer/Qarminer/godot/platform/linuxbsd/godot_linuxbsd.cpp:76)
[23] /lib/x86_64-linux-gnu/libc.so.6(+0x29d90) [0x7fd276e29d90] (??:0)
[24] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x80) [0x7fd276e29e40] (??:0)
[25] ./godot.linuxbsd.editor.dev.x86_64.san(_start+0x25) [0x55858bb82705] (??:?)
-- END OF BACKTRACE --
================================================================
Aborted (core dumped)

Command:

./reproducer" "godot.linuxbsd.editor.dev.x86_64.san" "60_50" "." "--audio-driver" "Dummy

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 visibe 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

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.

2 participants