godotengine / godotengine/godot
Use `split_floats` on an empty string will cause a crash.
- Dominant language
- C++
- Stars
- 117k
- Forks
- 26.8k
- PR merge metrics
- PR metrics pending
Description
### Tested versions
- Reproduciable in 4.4.
- Not reproduciable in 4.3.
### System information
Windows 10 - v4.4.stable.steam [4c311cbee]
### Issue description
Use `split_floats` on an empty string will cause a crash, and cannot see any output in the editor.
I tried to export the project and run it in the console and saw the following error:
```
ERROR: Index p_index = 0 is out of bounds (size() = 0).
at: set (./core/templates/cowdata.h:207)
ERROR: FATAL: Index p_index = 0 is out of bounds (size() = 0).
at: get (./core/templates/cowdata.h:219)
```
### Steps to reproduce
Just execute the code below (GDScript):
``` gdscript
"".split_floats(",")
```
### Minimal reproduction project (MRP)
[test_2025-03-08_20-24-59.zip](https://github.com/user-attachments/files/19143271/test_2025-03-08_20-24-59.zip)
Contributor guide
Research direction
Reproduce the crash with the GDScript expression "".split_floats(",") and inspect the related access reported in core/templates/cowdata.h. Determine the expected behavior for an empty string, then verify that the expression no longer crashes and that its output is handled consistently.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- game-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100