### Godot version

4.1.beta.custom_build. a83eb16fb

### System information

Ubuntu 22.04 CI

### Issue description

When executing
```
 extends Node
func _process(delta):

	var temp_variable293 = NavigationMeshSourceGeometryData3D.new()
	temp_variable293.set_local_to_scene(false)
	temp_variable293.add_mesh(RibbonTrailMesh.new(), Transform3D(Basis(Vector3(-0.57634198665619, 0.27070340514183, 0.77107042074203), Vector3(0.55228537321091, 0.61048728227615, -0.56770241260529), Vector3(-0.04233288764954, 0.61028271913528, -0.79105180501938)), Vector3(-0.68570566177368, -0.72787898778915, 0)))
```
Godot crashes:
```
 ERROR: Condition "vertex_data.size() == 0 && (p_data.format & RenderingServer::ARRAY_FORMAT_VERTEX)" is true. Returning: Array()
   at: mesh_create_arrays_from_surface_data (servers/rendering_server.cpp:1392)
ERROR: FATAL: Index p_index = 0 is out of bounds (((Vector<T> *)(this))->_cowdata.size() = 0).
   at: operator[] (./core/templates/vector.h:52)

================================================================
handle_crash: Program crashed with signal 4
Engine version: Godot Engine v4.1.beta.custom_build (116f783db73f4bf7e9e96ae54dd3d0a20337cc8a)
Dumping the backtrace. Please include this when reporting the bug to the project developer.
[1] ./godot.linuxbsd.editor.dev.x86_64.san(+0x3a3fb84c) [0x55720b66084c] (/home/runner/work/Qarminer/Qarminer/godot/platform/linuxbsd/crash_handler_linuxbsd.cpp:57)
[2] /lib/x86_64-linux-gnu/libc.so.6(+0x42520) [0x7f70d04d2520] (??:0)
[3] VectorWriteProxy<Variant>::operator[](int) (/home/runner/work/Qarminer/Qarminer/godot/./core/templates/vector.h:52 (discriminator 7))
[4] Array::operator[](int) (/home/runner/work/Qarminer/Qarminer/godot/core/variant/array.cpp:89)
[5] NavigationMeshSourceGeometryData3D::_add_mesh(Ref<Mesh> const&, Transform3D const&) (/home/runner/work/Qarminer/Qarminer/godot/scene/resources/navigation_mesh_source_geometry_data_3d.cpp:74 (discriminator 3))
[6] NavigationMeshSourceGeometryData3D::add_mesh(Ref<Mesh> const&, Transform3D const&) (/home/runner/work/Qarminer/Qarminer/godot/scene/resources/navigation_mesh_source_geometry_data_3d.cpp:143)
[7] void call_with_variant_args_helper<__UnexistingClass, Ref<Mesh> const&, Transform3D const&, 0ul, 1ul>(__UnexistingClass*, void (__UnexistingClass::*)(Ref<Mesh> const&, Transform3D const&), Variant const**, Callable::CallError&, IndexSequence<0ul, 1ul>) (/home/runner/work/Qarminer/Qarminer/godot/./core/variant/binder_common.h:303 (discriminator 8))
[8] void call_with_variant_args_dv<__UnexistingClass, Ref<Mesh> const&, Transform3D const&>(__UnexistingClass*, void (__UnexistingClass::*)(Ref<Mesh> const&, Transform3D const&), Variant const**, int, Callable::CallError&, Vector<Variant> const&) (/home/runner/work/Qarminer/Qarminer/godot/./core/variant/binder_common.h:421)
[9] MethodBindT<Ref<Mesh> const&, Transform3D const&>::call(Object*, Variant const**, int, Callable::CallError&) const (/home/runner/work/Qarminer/Qarminer/godot/./core/object/method_bind.h:331)
[10] Object::callp(StringName const&, Variant const**, int, Callable::CallError&) (/home/runner/work/Qarminer/Qarminer/godot/core/object/object.cpp:739 (discriminator 1))
[11] Variant::callp(StringName const&, Variant const**, int, Variant&, Callable::CallError&) (/home/runner/work/Qarminer/Qarminer/godot/core/variant/variant_call.cpp:1174)
[12] GDScriptFunction::call(GDScriptInstance*, Variant const**, int, Callable::CallError&, GDScriptFunction::CallState*) (/home/runner/work/Qarminer/Qarminer/godot/modules/gdscript/gdscript_vm.cpp:1663)
[13] GDScriptInstance::callp(StringName const&, Variant const**, int, Callable::CallError&) (/home/runner/work/Qarminer/Qarminer/godot/modules/gdscript/gdscript.cpp:1791)
[14] bool Node::_gdvirtual__process_call<false>(double) (/home/runner/work/Qarminer/Qarminer/godot/scene/main/node.h:318 (discriminator 5))
[15] Node::_notification(int) (/home/runner/work/Qarminer/Qarminer/godot/scene/main/node.cpp:57)
[16] Node::_notificationv(int, bool) (/home/runner/work/Qarminer/Qarminer/godot/./scene/main/node.h:49 (discriminator 14))
[17] Object::notification(int, bool) (/home/runner/work/Qarminer/Qarminer/godot/core/object/object.cpp:798)
[18] SceneTree::_process_group(SceneTree::ProcessGroup*, bool) (/home/runner/work/Qarminer/Qarminer/godot/scene/main/scene_tree.cpp:941)
[19] SceneTree::_process(bool) (/home/runner/work/Qarminer/Qarminer/godot/scene/main/scene_tree.cpp:1014 (discriminator 2))
[20] SceneTree::process(double) (/home/runner/work/Qarminer/Qarminer/godot/scene/main/scene_tree.cpp:506 (discriminator 4))
[21] Main::iteration() (/home/runner/work/Qarminer/Qarminer/godot/main/main.cpp:3420)
[22] OS_LinuxBSD::run() (/home/runner/work/Qarminer/Qarminer/godot/platform/linuxbsd/os_linuxbsd.cpp:912)
[23] ./godot.linuxbsd.editor.dev.x86_64.san(main+0x58f) [0x55720b6601f8] (/home/runner/work/Qarminer/Qarminer/godot/platform/linuxbsd/godot_linuxbsd.cpp:76)
[24] /lib/x86_64-linux-gnu/libc.so.6(+0x29d90) [0x7f70d04b9d90] (??:0)
[25] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x80) [0x7f70d04b9e40] (??:0)
[26] ./godot.linuxbsd.editor.dev.x86_64.san(_start+0x25) [0x55720b65fba5] (??:?)
-- END OF BACKTRACE --
================================================================
```


This example was found by Godot fuzzer - [Qarminer](https://github.com/qarmin/Qarminer), so it is quite unlikelly that this code could be used in real project, but still this should be handled gracefully.

Memory leaks or asan backtraces are visibe when using Godot build with sanitizers support - https://github.com/qarmin/GodotBuilds/actions (linux -> linux-editor-sanitizers)


### Steps to reproduce

Above

### Minimal reproduction project

Above
Error err = ConvexHullComputer::convex_hull(varr, md);
						if (err == OK) {
							PackedVector3Array faces;
							for (const Geometry3D::MeshData::Face &face : md.faces) {
								for (uint32_t k = 2; k < face.indices.size(); ++k) {
									faces.push_back(md.vertices[face.indices[0]]);
									faces.push_back(md.vertices[face.indices[k - 1]]);
									faces.push_back(md.vertices[face.indices[k]]);
								}
							}
							_add_faces(faces, transform, p_vertices, p_indices);
						}
					}
					HeightMapShape3D *heightmap_shape = Object::cast_to<HeightMapShape3D>(*s);
					if (heightmap_shape) {
						int heightmap_depth = heightmap_shape->get_map_depth();
						int heightmap_width = heightmap_shape->get_map_width();
						if (heightmap_depth >= 2 && heightmap_width >= 2) {
							const Vector<real_t> &map_data = heightmap_shape->get_map_data();
							Vector2 heightmap_gridsize(heightmap_width - 1, heightmap_depth - 1);
							Vector2 start = heightmap_gridsize * -0.5;
							Vector<Vector3> vertex_array;
							vertex_array.resize((heightmap_depth - 1) * (heightmap_width - 1) * 6);
							int map_data_current_index = 0;
							for (int d = 0; d < heightmap_depth; d++) {
								for (int w = 0; w < heightmap_width; w++) {
									if (map_data_current_index + 1 + heightmap_depth < map_data.size()) {
										float top_left_height = map_data[map_data_current_index];
										float top_right_height = map_data[map_data_current_index + 1];
										float bottom_left_height = map_data[map_data_current_index + heightmap_depth];