Repository: godot
Issue: Geometry.make_atlas() fatal fails with large atlas sizes in x-direction
Labels: discussion,documentation,topic:2d

### Tested versions

Reproducibe in:
- v4.2.2.stable.official [15073afe3]
- v4.3.beta2.mono.official [b75f0485b]

### System information

Godot v4.3.beta2.mono - Windows 10.0.22631 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 4080 SUPER (NVIDIA; 32.0.15.5612) - AMD Ryzen 7 5700X 8-Core Processor (16 Threads)

### Issue description

Calling `Geometry2d.make_atlas` (https://docs.godotengine.org/en/stable/classes/class_geometry2d.html#class-geometry2d-method-make-atlas) with an array in which one size has a large x value causes the game to crash with a fatal error that cannot be caught (in C# raises an SEHException and crashes despite catch, GDScript just exits the game). Interestinly enough, the same does not appear with a large y-value. I was not able to pinpoint the exact value at which the crash occurs. It seems to be between 4000 and 5000.
See this forum post for possible discussion: https://forum.godotengine.org/t/geometry2d-makeatlas-throws-sehexception/69237

### Steps to reproduce

```gdscript
extends Node

func _ready() -> void:
  # No crash
  var small_atlas = Geometry2D.make_atlas([Vector2(10, 10)])
  print(small_atlas)

  # No crash
  var large_y_atlas = Geometry2D.make_atlas([Vector2(10, 5000)])
  print(large_y_atlas)

  # Crash
  var large_x_atlas = Geometry2D.make_atlas([Vector2(5000, 10)])
  print(large_x_atlas)
```

Godot Log in latest beta version (stable is the same without the crash handler):
```
Godot Engine v4.3.beta2.mono.official.b75f0485b - https://godotengine.org
WARNING: Project setting "rendering/limits/global_shader_variables/buffer_size" exceeds maximum uniform buffer size of:.
     at: MaterialStorage (drivers/gles3/storage/material_storage.cpp:1115)
OpenGL API 3.3.0 NVIDIA 556.12 - Compatibility - Using Device: NVIDIA - NVIDIA GeForce RTX 4080 SUPER

Editing project: S:/Projects/AtlasBug
Godot Engine v4.3.beta2.mono.official.b75f0485b - https://godotengine.org
Vulkan 1.3.278 - Forward+ - Using Device #0: NVIDIA - NVIDIA GeForce RTX 4080 SUPER

Godot Engine v4.3.beta2.mono.official.b75f0485b - https://godotengine.org
Vulkan 1.3.278 - Forward+ - Using Device #0: NVIDIA - NVIDIA GeForce RTX 4080 SUPER

{ "points": [(0, 0)], "size": (10, 10) }
{ "points": [(0, 0)], "size": (10, 5000) }
ERROR: FATAL: Index p_index = -1 is out of bounds (size() = 0).
   at: get (./core/templates/cowdata.h:205)

================================================================
CrashHandlerException: Program crashed with signal 4
Engine version: Godot Engine v4.3.beta2.mono.official (b75f0485ba15951b87f1d9a2d8dd0fcd55e178e4)
Dumping the backtrace. Please include this when reporting the bug to the project developer.
[1] error(-1): no debug info in PE/COFF executable
[2] error(-1): no debug info in PE/COFF executable
[3] error(-1): no debug info in PE/COFF executable
[4] error(-1): no debug info in PE/COFF executable
[5] error(-1): no debug info in PE/COFF executable
[6] error(-1): no debug info in PE/COFF executable
[7] error(-1): no debug info in PE/COFF executable
[8] error(-1): no debug info in PE/COFF executable
[9] error(-1): no debug info in PE/COFF executable
[10] error(-1): no debug info in PE/COFF executable
[11] error(-1): no debug info in PE/COFF executable
[12] error(-1): no debug info in PE/COFF executable
[13] error(-1): no debug info in PE/COFF executable
[14] error(-1): no debug info in PE/COFF executable
[15] error(-1): no debug info in PE/COFF executable
[16] error(-1): no debug info in PE/COFF executable
[17] error(-1): no debug info in PE/COFF executable
[18] error(-1): no debug info in PE/COFF executable
[19] error(-1): no debug info in PE/COFF executable
[20] error(-1): no debug info in PE/COFF executable
[21] error(-1): no debug info in PE/COFF executable
-- END OF BACKTRACE --
```

### Minimal reproduction project (MRP)

MRP for 4.3-beta2 (created with the Mono version, but the sample is in GDScript)

[AtlasBug.zip](https://github.com/user-attachments/files/16046243/AtlasBug.zip)