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

Slice array with negative step and out of bound index crash the engine #79093

Closed
HaruYou27 opened this issue Jul 6, 2023 · 1 comment · Fixed by #79103
Closed

Slice array with negative step and out of bound index crash the engine #79093

HaruYou27 opened this issue Jul 6, 2023 · 1 comment · Fixed by #79103

Comments

@HaruYou27
Copy link

Godot version

v4.0.3.stable.arch_linux

System information

archlinux

Issue description

The code below will crash the engine without any error or warning from the editor.

var arr := [1,2,3,4,5,6,7,8,9]
func _ready():
	print(arr.slice(50, 0, -1))

Here the console log:

handle_crash: Program crashed with signal 4
Engine version: Godot Engine v4.0.3.stable.arch_linux
Dumping the backtrace. Please include this when reporting the bug to the project developer.
[1] /usr/lib/libc.so.6(+0x39ab0) [0x7f886a04fab0] (??:0)
[2] /usr/bin/godot(+0x46ee2f3) [0x56088fdb82f3] (??:?)
[3] /usr/bin/godot(+0x472b175) [0x56088fdf5175] (??:?)
[4] /usr/bin/godot(+0x47383d8) [0x56088fe023d8] (??:?)
[5] /usr/bin/godot(+0x1512883) [0x56088cbdc883] (??:?)
[6] /usr/bin/godot(+0x13fa8fd) [0x56088cac48fd] (??:?)
[7] /usr/bin/godot(+0x2e5fe23) [0x56088e529e23] (??:?)
[8] /usr/bin/godot(+0x3389728) [0x56088ea53728] (??:?)
[9] /usr/bin/godot(+0x48ba7a8) [0x56088ff847a8] (??:?)
[10] /usr/bin/godot(+0x2e28d96) [0x56088e4f2d96] (??:?)
[11] /usr/bin/godot(+0x2e28d37) [0x56088e4f2d37] (??:?)
[12] /usr/bin/godot(+0x2e5d5bf) [0x56088e5275bf] (??:?)
[13] /usr/bin/godot(+0x2e5eb33) [0x56088e528b33] (??:?)
[14] /usr/bin/godot(+0x10a1479) [0x56088c76b479] (??:?)
[15] /usr/lib/libc.so.6(+0x23850) [0x7f886a039850] (??:0)
[16] /usr/lib/libc.so.6(__libc_start_main+0x8a) [0x7f886a03990a] (??:0)
[17] /usr/bin/godot(+0x10afda5) [0x56088c779da5] (??:?)
-- END OF BACKTRACE --

Steps to reproduce

n/a

Minimal reproduction project

n/a

@AThousandShips
Copy link
Member

AThousandShips commented Jul 6, 2023

Does print an error in the console, but it seems the index management is broken when the range is reversed, will take a look

Got a fix working, will open a PR soon

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.

3 participants