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

Calling Image::fill lead to engine crash #67567

Closed
Chaosus opened this issue Oct 18, 2022 · 4 comments · Fixed by #67823
Closed

Calling Image::fill lead to engine crash #67567

Chaosus opened this issue Oct 18, 2022 · 4 comments · Fixed by #67823

Comments

@Chaosus
Copy link
Member

Chaosus commented Oct 18, 2022

Godot version

2e3662a

System information

Windows 11

Issue description

Execution of that function lead to engine crash.

Steps to reproduce

Try to execute the following code:

	var image = Image.new()
	image.create(64, 64, false, Image.FORMAT_RGB8)
	image.fill(Color.WHITE)

Seems like a recent regression.

Call Stack:

================================================================
CrashHandlerException: Program crashed
Engine version: Godot Engine v4.0.beta.custom_build (2e3662acbd8586697db38569785cc9f97dff945e)
Dumping the backtrace. Please include this when reporting the bug on: https://github.com/godotengine/godot/issues
[0] Image::fill (C:\Git\godot\core\io\image.cpp:2872)
[1] MethodBindT<Light3D,Color const &>::call (C:\Git\godot\core\object\method_bind.h:318)
[2] Object::callp (C:\Git\godot\core\object\object.cpp:733)
[3] Variant::callp (C:\Git\godot\core\variant\variant_call.cpp:1048)
[4] GDScriptFunction::call (C:\Git\godot\modules\gdscript\gdscript_vm.cpp:1555)
[5] GDScriptInstance::callp (C:\Git\godot\modules\gdscript\gdscript.cpp:1629)
[6] Node::_notification (C:\Git\godot\scene\main\node.cpp:154)
[7] Node3D::_notificationv (C:\Git\godot\scene\3d\node_3d.h:52)
[8] Object::notification (C:\Git\godot\core\object\object.cpp:792)
[9] Node::_propagate_ready (C:\Git\godot\scene\main\node.cpp:188)
[10] Node::_propagate_ready (C:\Git\godot\scene\main\node.cpp:178)
[11] Node::_set_tree (C:\Git\godot\scene\main\node.cpp:2525)
[12] SceneTree::initialize (C:\Git\godot\scene\main\scene_tree.cpp:411)
[13] OS_Windows::run (C:\Git\godot\platform\windows\os_windows.cpp:993)
[14] widechar_main (C:\Git\godot\platform\windows\godot_windows.cpp:181)
[15] _main (C:\Git\godot\platform\windows\godot_windows.cpp:205)
[16] main (C:\Git\godot\platform\windows\godot_windows.cpp:217)
[17] __scrt_common_main_seh (D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288)
[18] BaseThreadInitThunk
-- END OF BACKTRACE --
================================================================

Minimal reproduction project

Too easy to reproduce, just paste the code above and run the debug.

@Chaosus Chaosus added this to the 4.0 milestone Oct 18, 2022
@Chaosus Chaosus changed the title Image::fill lead to engine crash Calling Image::fill lead to engine crash Oct 18, 2022
@KoBeWi
Copy link
Member

KoBeWi commented Oct 18, 2022

Image.create() is now static, so you are calling fill() on a null.
But it still shouldn't crash I guess.

@KoBeWi KoBeWi removed the regression label Oct 18, 2022
@qarmin
Copy link
Contributor

qarmin commented Oct 18, 2022

Image.new().fill(Color.WHITE)
core/io/image.cpp:3071:13: runtime error: store to null pointer of type 'uint8_t'

================================================================
handle_crash: Program crashed with signal 11
Engine version: Godot Engine v4.0.beta.custom_build (28a4eec9a77bc797b7147be2453cdbe85cf47d7f)
Dumping the backtrace. Please include this when reporting the bug on: https://github.com/godotengine/godot/issues
[1] godot4s() [0x2648160] (/home/runner/work/GodotBuilds/GodotBuilds/godot/platform/linuxbsd/crash_handler_linuxbsd.cpp:56)
[2] /lib/x86_64-linux-gnu/libc.so.6(+0x42520) [0x7f16ad41e520] (??:0)
[3] Image::_set_color_at_ofs(unsigned char*, unsigned int, Color const&) (/home/runner/work/GodotBuilds/GodotBuilds/godot/core/io/image.cpp:3071 (discriminator 3))
[4] Image::fill(Color const&) (/home/runner/work/GodotBuilds/GodotBuilds/godot/core/io/image.cpp:2874)
[5] void call_with_variant_args_helper<__UnexistingClass, Color const&, 0ul>(__UnexistingClass*, void (__UnexistingClass::*)(Color const&), Variant const**, Callable::CallError&, IndexSequence<0ul>) (/home/runner/work/GodotBuilds/GodotBuilds/godot/./core/variant/binder_common.h:267 (discriminator 4))
[6] void call_with_variant_args_dv<__UnexistingClass, Color const&>(__UnexistingClass*, void (__UnexistingClass::*)(Color const&), Variant const**, int, Callable::CallError&, Vector<Variant> const&) (/home/runner/work/GodotBuilds/GodotBuilds/godot/./core/variant/binder_common.h:380)
[7] MethodBindT<Color const&>::call(Object*, Variant const**, int, Callable::CallError&) (/home/runner/work/GodotBuilds/GodotBuilds/godot/./core/object/method_bind.h:320)
[8] Object::callp(StringName const&, Variant const**, int, Callable::CallError&) (/home/runner/work/GodotBuilds/GodotBuilds/godot/core/object/object.cpp:733 (discriminator 1))
[9] Object::callv(StringName const&, Array const&) (/home/runner/work/GodotBuilds/GodotBuilds/godot/core/object/object.cpp:671 (discriminator 1))
[10] void call_with_variant_args_ret_helper<__UnexistingClass, Variant, StringName const&, Array const&, 0ul, 1ul>(__UnexistingClass*, Variant (__UnexistingClass::*)(StringName const&, Array const&), Variant const**, Variant&, Callable::CallError&, IndexSequence<0ul, 1ul>) (/home/runner/work/GodotBuilds/GodotBuilds/godot/./core/variant/binder_common.h:680 (discriminator 8))
[11] void call_with_variant_args_ret_dv<__UnexistingClass, Variant, StringName const&, Array const&>(__UnexistingClass*, Variant (__UnexistingClass::*)(StringName const&, Array const&), Variant const**, int, Variant&, Callable::CallError&, Vector<Variant> const&) (/home/runner/work/GodotBuilds/GodotBuilds/godot/./core/variant/binder_common.h:464)
[12] MethodBindTR<Variant, StringName const&, Array const&>::call(Object*, Variant const**, int, Callable::CallError&) (/home/runner/work/GodotBuilds/GodotBuilds/godot/./core/object/method_bind.h:465)
[13] GDScriptFunction::call(GDScriptInstance*, Variant const**, int, Callable::CallError&, GDScriptFunction::CallState*) (/home/runner/work/GodotBuilds/GodotBuilds/godot/modules/gdscript/gdscript_vm.cpp:1644 (discriminator 1))
[14] GDScriptInstance::callp(StringName const&, Variant const**, int, Callable::CallError&) (/home/runner/work/GodotBuilds/GodotBuilds/godot/modules/gdscript/gdscript.cpp:1629)
[15] Object::callp(StringName const&, Variant const**, int, Callable::CallError&) (/home/runner/work/GodotBuilds/GodotBuilds/godot/core/object/object.cpp:711 (discriminator 1))
[16] Variant::callp(StringName const&, Variant const**, int, Variant&, Callable::CallError&) (/home/runner/work/GodotBuilds/GodotBuilds/godot/core/variant/variant_call.cpp:1048)
[17] GDScriptFunction::call(GDScriptInstance*, Variant const**, int, Callable::CallError&, GDScriptFunction::CallState*) (/home/runner/work/GodotBuilds/GodotBuilds/godot/modules/gdscript/gdscript_vm.cpp:1554)
[18] GDScriptInstance::callp(StringName const&, Variant const**, int, Callable::CallError&) (/home/runner/work/GodotBuilds/GodotBuilds/godot/modules/gdscript/gdscript.cpp:1629)
[19] bool Node::_gdvirtual__process_call<false>(double) (/home/runner/work/GodotBuilds/GodotBuilds/godot/scene/main/node.h:238 (discriminator 5))
[20] Node::_notification(int) (/home/runner/work/GodotBuilds/GodotBuilds/godot/scene/main/node.cpp:57)
[21] Node::_notificationv(int, bool) (/home/runner/work/GodotBuilds/GodotBuilds/godot/./scene/main/node.h:45 (discriminator 14))
[22] Object::notification(int, bool) (/home/runner/work/GodotBuilds/GodotBuilds/godot/core/object/object.cpp:792)
[23] SceneTree::_notify_group_pause(StringName const&, int) (/home/runner/work/GodotBuilds/GodotBuilds/godot/scene/main/scene_tree.cpp:868)
[24] SceneTree::process(double) (/home/runner/work/GodotBuilds/GodotBuilds/godot/scene/main/scene_tree.cpp:466 (discriminator 4))
[25] Main::iteration() (/home/runner/work/GodotBuilds/GodotBuilds/godot/main/main.cpp:3137)
[26] OS_LinuxBSD::run() (/home/runner/work/GodotBuilds/GodotBuilds/godot/platform/linuxbsd/os_linuxbsd.cpp:772)
[27] godot4s(main+0x49e) [0x26453f4] (/home/runner/work/GodotBuilds/GodotBuilds/godot/platform/linuxbsd/godot_linuxbsd.cpp:74)
[28] /lib/x86_64-linux-gnu/libc.so.6(+0x29d90) [0x7f16ad405d90] (??:0)
[29] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x80) [0x7f16ad405e40] (??:0)
[30] godot4s(_start+0x2e) [0x2644e9e] (??:?)
-- END OF BACKTRACE --
================================================================

@Mickeon
Copy link
Contributor

Mickeon commented Oct 19, 2022

It's been discussed in the past, but it should also warn you that it is a static function.

@Zireael07
Copy link
Contributor

@Mickeon: Warning on static functions was added in #67365

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

Successfully merging a pull request may close this issue.

5 participants