Geometry2D.MakeAtlas throws SEHException

Godot Version

Up to 4.3.0-beta.2 (Mono)

Question

Geometry2D.MakeAtlas throws a System.Runtime.InteropServices.SEHException with large-ish atlas sizes in X-direction.

Reproduction sample

for (var i = 1; i < 20; i++) {
    var x = i * 256;
    GD.Print("Trying size " + i + " = " + x + " ...");
    try {
        var sizes = new Vector2[] {
            new(x, 256),
        };
        var dict = Geometry2D.MakeAtlas(sizes);
        GD.Print(dict);
    } catch (Exception e) {
        GD.PrintErr(e);
    }
}

Logs the following:

Trying size 1 = 256 ...
{ "points": [(0, 0)], "size": (256, 256) }
Trying size 2 = 512 ...
{ "points": [(0, 0)], "size": (512, 256) }
Trying size 3 = 768 ...
{ "points": [(0, 0)], "size": (768, 256) }
Trying size 4 = 1024 ...
{ "points": [(0, 0)], "size": (1024, 256) }
Trying size 5 = 1280 ...
{ "points": [(0, 0)], "size": (1280, 256) }
Trying size 6 = 1536 ...
{ "points": [(0, 0)], "size": (1536, 256) }
Trying size 7 = 1792 ...
{ "points": [(0, 0)], "size": (1792, 256) }
Trying size 8 = 2048 ...
{ "points": [(0, 0)], "size": (2048, 256) }
Trying size 9 = 2304 ...
{ "points": [(0, 0)], "size": (2304, 256) }
Trying size 10 = 2560 ...
{ "points": [(0, 0)], "size": (2560, 256) }
Trying size 11 = 2816 ...
{ "points": [(0, 0)], "size": (2816, 256) }
Trying size 12 = 3072 ...
{ "points": [(0, 0)], "size": (3072, 256) }
Trying size 13 = 3328 ...
{ "points": [(0, 0)], "size": (3328, 256) }
Trying size 14 = 3584 ...
{ "points": [(0, 0)], "size": (3584, 256) }
Trying size 15 = 3840 ...
{ "points": [(0, 0)], "size": (3840, 256) }
Trying size 16 = 4096 ...
{ "points": [(0, 0)], "size": (4096, 256) }
Trying size 17 = 4352 ...
ERROR: FATAL: Index p_index = -1 is out of bounds (size() = 0).
   at: get (./core/templates/cowdata.h:205)
Fatal error. System.Runtime.InteropServices.SEHException (0x80004005): External component has thrown an exception.

I can’t really work around this, since some textures just are this size. An atlas in our currenctly production version is made up of e.g. the following sizes:

(256, 256),(256, 256),(256, 256),(256, 512),(256, 512),(512, 768),(512, 768),(256, 256),(256, 256),(256, 256),(256, 256),(256, 256),(256, 256),(256, 256),(256, 256),(256, 256),(256, 256),(256, 256),(256, 256),(256, 256),(256, 256),(256, 256),(256, 256),(256, 256),(256, 256),(256, 256),(256, 256),(256, 256),(256, 256),(256, 256),(256, 256),(256, 256),(256, 256),(256, 256),(256, 256),(256, 256),(256, 256),(256, 256),(256, 256),(4352, 256),(256, 256),(256, 256),(256, 256),(256, 256),(256, 256),(256, 256),(256, 256),(256, 256),(256, 256),(256, 256),(256, 256),(256, 256),(256, 256),(256, 256),(256, 256),(256, 256),(256, 256),(256, 256),(256, 256),(256, 256),(256, 256),(256, 256),(256, 256),(256, 256),(256, 256),(256, 256),(256, 256),(256, 256),(256, 256),(256, 256),(256, 256),(256, 256),(256, 256),(256, 256),(256, 256),(256, 256),(256, 256),(256, 256),(256, 256),(256, 256),(256, 256),(256, 256),(256, 256),(256, 256)

I filed a bug report here: Geometry.make_atlas() fatal fails with large atlas sizes in x-direction · Issue #93795 · godotengine/godot · GitHub
The same issue appears with GDScript.