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

Geometry.make_atlas() crashes Godot when sizes are large #51154

Open
Zylann opened this issue Aug 1, 2021 · 1 comment
Open

Geometry.make_atlas() crashes Godot when sizes are large #51154

Zylann opened this issue Aug 1, 2021 · 1 comment

Comments

@Zylann
Copy link
Contributor

Zylann commented Aug 1, 2021

Godot version

3.4 beta2

System information

Windows 10 64 bits GLES3

Issue description

The following code crashes Godot:

	Geometry.make_atlas(PoolVector2Array([
		Vector2(244155, 436296),
		Vector2(70720, 32904)
	]))

Sizes are positive, and below INT_MAX, so it should have worked.
The fix previously done in #46401 covered negative sizes only so it likely also applies to master.

Steps to reproduce

Run the code shown in description.

Minimal reproduction project

MakeAtlasCrash.zip

@Zylann Zylann changed the title Gemoetry.make_atlas() crashes Godot when sizes are large Geometry.make_atlas() crashes Godot when sizes are large Aug 1, 2021
@qarmin
Copy link
Contributor

qarmin commented Aug 1, 2021

Backtrace

ERROR: FATAL: Index p_index = -1 is out of bounds (size() = 0).
   at: get (./core/cowdata.h:156)
handle_crash: Program crashed with signal 4
Dumping the backtrace. Please include this when reporting the bug on https://github.com/godotengine/godot/issues
[1] godots() [0x17b5100] (/mnt/Miecz/godot3.2/platform/x11/crash_handler_x11.cpp:54)
[2] /lib/x86_64-linux-gnu/libc.so.6(+0x41040) [0x7fa40d4c4040] (??:0)
[3] CowData<_AtlasWorkRectResult>::get(int) const (/mnt/Miecz/godot3.2/./core/cowdata.h:156 (discriminator 7))
[4] Vector<_AtlasWorkRectResult>::operator[](int) const (/mnt/Miecz/godot3.2/./core/vector.h:87)
[5] Geometry::make_atlas(Vector<Vector2i> const&, Vector<Vector2i>&, Vector2i&) (/mnt/Miecz/godot3.2/core/math/geometry.cpp:1047)
[6] _Geometry::make_atlas(Vector<Vector2> const&) (/mnt/Miecz/godot3.2/core/bind/core_bind.cpp:1765)
[7] MethodBind1R<Dictionary, Vector<Vector2> const&>::call(Object*, Variant const**, int, Variant::CallError&) (/mnt/Miecz/godot3.2/./core/method_bind.gen.inc:961 (discriminator 9))
[8] Object::call(StringName const&, Variant const**, int, Variant::CallError&) (/mnt/Miecz/godot3.2/core/object.cpp:918 (discriminator 1))
[9] Variant::call_ptr(StringName const&, Variant const**, int, Variant*, Variant::CallError&) (/mnt/Miecz/godot3.2/core/variant_call.cpp:1173 (discriminator 1))
[10] GDScriptFunction::call(GDScriptInstance*, Variant const**, int, Variant::CallError&, GDScriptFunction::CallState*) (/mnt/Miecz/godot3.2/modules/gdscript/gdscript_function.cpp:1037)
[11] GDScriptInstance::_ml_call_reversed(GDScript*, StringName const&, Variant const**, int) (/mnt/Miecz/godot3.2/modules/gdscript/gdscript.cpp:1181)
[12] GDScriptInstance::call_multilevel_reversed(StringName const&, Variant const**, int) (/mnt/Miecz/godot3.2/modules/gdscript/gdscript.cpp:1189)
[13] Node::_notification(int) (/mnt/Miecz/godot3.2/scene/main/node.cpp:149)
[14] Node::_notificationv(int, bool) (/mnt/Miecz/godot3.2/./scene/main/node.h:45 (discriminator 14))
[15] Object::notification(int, bool) (/mnt/Miecz/godot3.2/core/object.cpp:929)
[16] Node::_propagate_ready() (/mnt/Miecz/godot3.2/scene/main/node.cpp:188)
[17] Node::_propagate_ready() (/mnt/Miecz/godot3.2/scene/main/node.cpp:178 (discriminator 2))
[18] Node::_set_tree(SceneTree*) (/mnt/Miecz/godot3.2/scene/main/node.cpp:2560)
[19] SceneTree::init() (/mnt/Miecz/godot3.2/scene/main/scene_tree.cpp:465)
[20] OS_X11::run() (/mnt/Miecz/godot3.2/platform/x11/os_x11.cpp:3633)
[21] godots(main+0x326) [0x17abd8c] (/mnt/Miecz/godot3.2/platform/x11/godot_x11.cpp:57)
[22] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xd5) [0x7fa40d4ab565] (??:0)
[23] godots(_start+0x2e) [0x17ab9ae] (??:?)

@akien-mga akien-mga added this to the 4.0 milestone Aug 2, 2021
@YuriSizov YuriSizov modified the milestones: 4.0, 4.x Feb 23, 2023
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

6 participants