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

Infinite loop caused by typed for-loop variable when looping through PackedDataContainer #89290

Closed
Rubonnek opened this issue Mar 8, 2024 · 1 comment · Fixed by #89639
Closed

Comments

@Rubonnek
Copy link
Member

Rubonnek commented Mar 8, 2024

Tested versions

ffc41fb - reproducible
4.2.1 - reproducible

System information

Godot v4.3.dev (55ebf09ea) - Arch Linux #1 SMP PREEMPT_DYNAMIC Sun, 03 Mar 2024 00:30:36 +0000 - Tty - GLES3 (Compatibility) - AMD Radeon RX 6900 XT (radeonsi, navi21, LLVM 17.0.6, DRM 3.57, 6.7.8-arch1-1) () - AMD Ryzen 9 5950X 16-Core Processor (32 Threads)

Issue description

When looping through a PackedDataContainer whose members should only be of type PackedDataContainerRef, specifying the latter as the type of a for-loop variable will cause an infinite loop when looping through the elements.

Steps to reproduce

Run the MRP.

The infinite loop is caused by ref : PackedDataContainerRef . Replacing that with just ref fixes the issue.

Minimal reproduction project (MRP)

TypedPDCRBug.zip

@AThousandShips
Copy link
Member

AThousandShips commented Mar 8, 2024

While the infinite error shouldn't happen, the data in it isn't guaranteed to just be the ref AFAIK, that's just with nested cases, so that part isn't a bug, the bug is the iteration breaking

As per the documentation:

Nested containers will be packed recursively. While iterating, they will be returned as PackedDataContainerRef.

This is probably because the iteration uses the empty/invalid value to start iteration, and therefore it will break if the value is invalud

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