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 AnimationPlayer._restore function crashes Godot #85340

Closed
qarmin opened this issue Nov 25, 2023 · 0 comments · Fixed by #85428
Closed

Executing AnimationPlayer._restore function crashes Godot #85340

qarmin opened this issue Nov 25, 2023 · 0 comments · Fixed by #85428

Comments

@qarmin
Copy link
Contributor

qarmin commented Nov 25, 2023

Godot version

4.2.rc.custom_build.1ba920fad

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_variable962 = AnimationPlayer.new()
	add_child(temp_variable962)
	temp_variable962._restore(null)

Godot crashes:

Godot Engine v4.2.rc.custom_build.1ba920fad - https://godotengine.org
Time set to: 0 seconds.
Loaded settings:
modules/gdscript/gdscript_vm.cpp:698:13: runtime error: store to misaligned address 0x62100012df5c for type '<unknown> *', which requires 8 byte alignment
0x62100012df5c: note: pointer points here
  04 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  15 00 00 00 10 00 00 01  14 00 00 00 06 00 00 00
              ^ 
'used_number' with value '10000'
modules/gdscript/gdscript_vm.cpp:705:42: runtime error: load of misaligned address 0x62100012df5c for type '<unknown> *', which requires 8 byte alignment
0x62100012df5c: note: pointer points here
  04 00 00 00 33 73 f0 dd  cf 55 00 00 00 00 00 00  15 00 00 00 10 00 00 01  14 00 00 00 06 00 00 00
              ^ 
'use_parent_methods' with value 'true'
'test_one_class_multiple_times' with value 'true'
######################## Ending test ########################
scene/animation/animation_mixer.cpp:2157:67: runtime error: member access within null pointer of type 'const struct AnimatedValuesBackup'
scene/animation/animation_mixer.cpp:2157:67: runtime error: member access within null pointer of type 'const struct AnimatedValuesBackup'
================================================================
handle_crash: Program crashed with signal 11
Engine version: Godot Engine v4.2.rc.custom_build (1ba920fada9efc8c4476ded50fe673b8db541366)
Dumping the backtrace. Please include this when reporting the bug to the project developer.
[1] ./godot.linuxbsd.editor.dev.x86_64.san(+0x3a2d9db1) [0x55cfc371cdb1] (/home/runner/work/Qarminer/Qarminer/godot/platform/linuxbsd/crash_handler_linuxbsd.cpp:61)
[2] /lib/x86_64-linux-gnu/libc.so.6(+0x42520) [0x7fd601842520] (??:0)
[3] HashMap<NodePath, AnimationMixer::TrackCache*, HashMapHasherDefault, HashMapComparatorDefault<NodePath>, DefaultTypedAllocator<HashMapElement<NodePath, AnimationMixer::TrackCache*> > >::begin() const (/home/runner/work/Qarminer/Qarminer/godot/./core/templates/hash_map.h:515)
[4] AnimatedValuesBackup::get_data() const (/home/runner/work/Qarminer/Qarminer/godot/scene/animation/animation_mixer.cpp:2157)
[5] AnimationMixer::restore(Ref<AnimatedValuesBackup> const&) (/home/runner/work/Qarminer/Qarminer/godot/scene/animation/animation_mixer.cpp:1983)
[6] void call_with_variant_args_helper<__UnexistingClass, Ref<AnimatedValuesBackup> const&, 0ul>(__UnexistingClass*, void (__UnexistingClass::*)(Ref<AnimatedValuesBackup> const&), Variant const**, Callable::CallError&, IndexSequence<0ul>) (/home/runner/work/Qarminer/Qarminer/godot/./core/variant/binder_common.h:303 (discriminator 4))
[7] void call_with_variant_args_dv<__UnexistingClass, Ref<AnimatedValuesBackup> const&>(__UnexistingClass*, void (__UnexistingClass::*)(Ref<AnimatedValuesBackup> const&), Variant const**, int, Callable::CallError&, Vector<Variant> const&) (/home/runner/work/Qarminer/Qarminer/godot/./core/variant/binder_common.h:421)
[8] MethodBindT<Ref<AnimatedValuesBackup> const&>::call(Object*, Variant const**, int, Callable::CallError&) const (/home/runner/work/Qarminer/Qarminer/godot/./core/object/method_bind.h:335)
[9] Object::callp(StringName const&, Variant const**, int, Callable::CallError&) (/home/runner/work/Qarminer/Qarminer/godot/core/object/object.cpp:775)
[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:1937)
[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:840)
[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:3636)
[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) [0x55cfc371c818] (/home/runner/work/Qarminer/Qarminer/godot/platform/linuxbsd/godot_linuxbsd.cpp:76)
[23] /lib/x86_64-linux-gnu/libc.so.6(+0x29d90) [0x7fd601829d90] (??:0)
[24] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x80) [0x7fd601829e40] (??:0)
[25] ./godot.linuxbsd.editor.dev.x86_64.san(_start+0x25) [0x55cfc371c1c5] (??:?)
-- 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

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