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 XRVRS.make_vrs_texture function crashes Godot #91575

Open
qarmin opened this issue May 5, 2024 · 0 comments
Open

Executing XRVRS.make_vrs_texture function crashes Godot #91575

qarmin opened this issue May 5, 2024 · 0 comments

Comments

@qarmin
Copy link
Contributor

qarmin commented May 5, 2024

Tested versions

4.3 7ebc866

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_variable167 = CurveXYZTexture.new()
	temp_variable167.get_curve_z()
	temp_variable167.get_curve_z()
	var temp_variable695 = ClassDB.instantiate("XRVRS")
	temp_variable695.make_vrs_texture(Vector2(13.656795501709, 2.21095085144043), PackedVector2Array([Vector2(-0.98681598901749, -0.16184644401073), Vector2(-0.83512741327286, 0.55005657672882), Vector2(-0.99132126569748, -0.13146139681339), Vector2(4.54152822494507, -50.6310768127441), Vector2(-0.17166988551617, 0.98515456914902), Vector2(0.99895811080933, 0.04563593864441), Vector2(6.26126527786255, -78.8213882446289), Vector2(95.6552658081055, -55.617115020752), Vector2(-0.91785502433777, 0.39691579341888), Vector2(22.272253036499, -6.87113380432129), Vector2(-0.83590620756149, -0.54887235164642), Vector2(-85.0020065307617, 95.512451171875), Vector2(-0.92967927455902, -0.36837002635002), Vector2(-30.7140293121338, 89.1704177856445), Vector2(-32.714672088623, 13.6189098358154), Vector2(-48.6023979187012, -40.9788475036621), Vector2(-0.77496576309204, 0.63200312852859), Vector2(33.5032234191895, -94.1455154418945), Vector2(-0.77173954248428, 0.63593870401382), Vector2(15.1372909545898, 42.6794509887695), Vector2(-0.18938341736794, -0.98190319538116), Vector2(45.6832885742188, -40.5465354919434), Vector2(-6.10998249053955, 57.2028884887695), Vector2(-2.77579426765442, 91.3980026245117), Vector2(53.3333892822266, -87.8164138793945)]))

Godot crashes:

Godot Engine v4.3.dev.custom_build - https://godotengine.org
servers/xr/xr_vrs.cpp:97:84: runtime error: division by zero
servers/xr/xr_vrs.cpp:97:47: runtime error: division by zero
core/math/vector2.cpp:210:21: runtime error: inf is outside the range of representable values of type 'int'
core/math/vector2.cpp:210:18: runtime error: inf is outside the range of representable values of type 'int'
servers/xr/xr_vrs.cpp:121:42: runtime error: inf is outside the range of representable values of type 'long int'
ERROR: Condition "p_size < 0" is true. Returning: ERR_INVALID_PARAMETER
   at: resize (./core/templates/cowdata.h:314)
servers/xr/xr_vrs.cpp:125:59: runtime error: inf is outside the range of representable values of type 'int'
servers/xr/xr_vrs.cpp:126:59: runtime error: inf is outside the range of representable values of type 'int'
servers/xr/xr_vrs.cpp:131:52: runtime error: signed integer overflow: 0 - -2147483648 cannot be represented in type 'int'
servers/xr/xr_vrs.cpp:131:33: runtime error: signed integer overflow: 0 - -2147483648 cannot be represented in type 'int'
servers/xr/xr_vrs.cpp:133:25: runtime error: -nan is outside the range of representable values of type 'unsigned char'
servers/xr/xr_vrs.cpp:133:20: runtime error: store to null pointer of type 'uint8_t'
================================================================
handle_crash: Program crashed with signal 11
Engine version: Godot Engine v4.3.dev.custom_build
Dumping the backtrace. Please include this when reporting the bug to the project developer.
[1] ./godot.linuxbsd.editor.dev.x86_64.san(+0x4023bbab) [0x55c9c430bbab] (/home/runner/work/Qarminer/Qarminer/godot/platform/linuxbsd/crash_handler_linuxbsd.cpp:61)
[2] /lib/x86_64-linux-gnu/libc.so.6(+0x42520) [0x7f00a2642520] (??:0)
[3] XRVRS::make_vrs_texture(Vector2 const&, Vector<Vector2> const&) (/home/runner/work/Qarminer/Qarminer/godot/servers/xr/xr_vrs.cpp:133 (discriminator 3))
[4] void call_with_variant_args_ret_helper<__UnexistingClass, RID, Vector2 const&, Vector<Vector2> const&, 0ul, 1ul>(__UnexistingClass*, RID (__UnexistingClass::*)(Vector2 const&, Vector<Vector2> const&), Variant const**, Variant&, Callable::CallError&, IndexSequence<0ul, 1ul>) (/home/runner/work/Qarminer/Qarminer/godot/./core/variant/binder_common.h:756 (discriminator 4))
[5] void call_with_variant_args_ret_dv<__UnexistingClass, RID, Vector2 const&, Vector<Vector2> const&>(__UnexistingClass*, RID (__UnexistingClass::*)(Vector2 const&, Vector<Vector2> const&), Variant const**, int, Variant&, Callable::CallError&, Vector<Variant> const&) (/home/runner/work/Qarminer/Qarminer/godot/./core/variant/binder_common.h:506)
[6] MethodBindTR<RID, Vector2 const&, Vector<Vector2> const&>::call(Object*, Variant const**, int, Callable::CallError&) const (/home/runner/work/Qarminer/Qarminer/godot/./core/object/method_bind.h:523)
[7] Object::callp(StringName const&, Variant const**, int, Callable::CallError&) (/home/runner/work/Qarminer/Qarminer/godot/core/object/object.cpp:842)
[8] Variant::callp(StringName const&, Variant const**, int, Variant&, Callable::CallError&) (/home/runner/work/Qarminer/Qarminer/godot/core/variant/variant_call.cpp:1212)
[9] GDScriptFunction::call(GDScriptInstance*, Variant const**, int, Callable::CallError&, GDScriptFunction::CallState*) (/home/runner/work/Qarminer/Qarminer/godot/modules/gdscript/gdscript_vm.cpp:1769)
[10] GDScriptInstance::callp(StringName const&, Variant const**, int, Callable::CallError&) (/home/runner/work/Qarminer/Qarminer/godot/modules/gdscript/gdscript.cpp:2005)
[11] bool Node::_gdvirtual__process_call<false>(double) (/home/runner/work/Qarminer/Qarminer/godot/scene/main/node.h:350 (discriminator 1))
[12] Node::_notification(int) (/home/runner/work/Qarminer/Qarminer/godot/scene/main/node.cpp:58)
[13] Node::_notificationv(int, bool) (/home/runner/work/Qarminer/Qarminer/godot/./scene/main/node.h:49 (discriminator 14))
[14] Object::notification(int, bool) (/home/runner/work/Qarminer/Qarminer/godot/core/object/object.cpp:907)
[15] SceneTree::_process_group(SceneTree::ProcessGroup*, bool) (/home/runner/work/Qarminer/Qarminer/godot/scene/main/scene_tree.cpp:963)
[16] SceneTree::_process(bool) (/home/runner/work/Qarminer/Qarminer/godot/scene/main/scene_tree.cpp:1035 (discriminator 2))
[17] SceneTree::process(double) (/home/runner/work/Qarminer/Qarminer/godot/scene/main/scene_tree.cpp:529)
[18] Main::iteration() (/home/runner/work/Qarminer/Qarminer/godot/main/main.cpp:4041)
[19] OS_LinuxBSD::run() (/home/runner/work/Qarminer/Qarminer/godot/platform/linuxbsd/os_linuxbsd.cpp:962)
[20] ./godot.linuxbsd.editor.dev.x86_64.san(main+0x4c7) [0x55c9c430b540] (/home/runner/work/Qarminer/Qarminer/godot/platform/linuxbsd/godot_linuxbsd.cpp:85)
[21] /lib/x86_64-linux-gnu/libc.so.6(+0x29d90) [0x7f00a2629d90] (??:0)
[22] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x80) [0x7f00a2629e40] (??:0)
[23] ./godot.linuxbsd.editor.dev.x86_64.san(_start+0x25) [0x55c9c430afb5] (??:?)
-- 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 (MRP)

Above

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

No branches or pull requests

1 participant