Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Error when resizing PackedByteArray bigger than int32 limit #77256

Closed
havi05 opened this issue May 19, 2023 · 1 comment · Fixed by #86730
Closed

Error when resizing PackedByteArray bigger than int32 limit #77256

havi05 opened this issue May 19, 2023 · 1 comment · Fixed by #86730
Milestone

Comments

@havi05
Copy link
Contributor

havi05 commented May 19, 2023

Godot version

4.0.3

System information

Windows 11 64-Bit

Issue description

The PackedByteArray can't be bigger than 2147483647. Following this issue it should be fixed in Godot 4.0 RC 1, but running the code below in Godot 4.0.3 results in this error.

E 0:00:00:0834   Node.gd:9 @ _ready(): Condition "p_size < 0" is true. Returning: ERR_INVALID_PARAMETER
  <C++-Quelle>   ./core/templates/cowdata.h:262 @ resize()
  <Stacktrace>   Node.gd:9 @ _ready()

Steps to reproduce

Run this code:

	var INT32_MAX = 2147483647 # 2^31 - 1
	var byte_arr = PackedByteArray()
	byte_arr.resize(INT32_MAX) # OK
	byte_arr.resize(INT32_MAX + 1) # error

Minimal reproduction project

PackedByteArrayError.zip

@Calinou
Copy link
Member

Calinou commented May 19, 2023

Related to #62585, #45296 and #54679.

Making CowData use 64-bit unsigned integers is welcome, but it's a significant undertaking as it requires replacing the type in all places where relevant.

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

Successfully merging a pull request may close this issue.

3 participants