### Godot version

7022271291a3d2a9cbd6a223d22a29fd775dfc5d

### System information

Windows 11, gl_compatibility, NVidia RTX 3070 TI

### Issue description

Crash doing a memcpy to null doing the surface upgrade. The code in question is:
```c++
	// Copy over all data needed for rendering.
	glBindBuffer(GL_ARRAY_BUFFER, state.canvas_instance_data_buffers[state.current_data_buffer_index].instance_buffers[state.current_instance_buffer_index]);
#ifdef WEB_ENABLED
	glBufferSubData(GL_ARRAY_BUFFER, state.last_item_index * sizeof(InstanceData), sizeof(InstanceData) * index, state.instance_data_array);
#else
	// On Desktop and mobile we map the memory without synchronizing for maximum speed.
	void *buffer = glMapBufferRange(GL_ARRAY_BUFFER, state.last_item_index * sizeof(InstanceData), index * sizeof(InstanceData), GL_MAP_WRITE_BIT | GL_MAP_UNSYNCHRONIZED_BIT);
	memcpy(buffer, state.instance_data_array, index * sizeof(InstanceData));
	glUnmapBuffer(GL_ARRAY_BUFFER);
#endif
```

The call stack is:
```
godot.windows.editor.dev.x86_64.exe!memcpy_repmovs() Line 40	Unknown
godot.windows.editor.dev.x86_64.exe!RasterizerCanvasGLES3::_render_items(RID p_to_render_target, int p_item_count, const Transform2D & p_canvas_transform_inverse, RendererCanvasRender::Light * p_lights, bool & r_sdf_used, bool p_to_backbuffer) Line 652	C++
godot.windows.editor.dev.x86_64.exe!RasterizerCanvasGLES3::canvas_render_items(RID p_to_render_target, RendererCanvasRender::Item * p_item_list, const Color & p_modulate, RendererCanvasRender::Light * p_light_list, RendererCanvasRender::Light * p_directional_light_list, const Transform2D & p_canvas_transform, RenderingServer::CanvasItemTextureFilter p_default_filter, RenderingServer::CanvasItemTextureRepeat p_default_repeat, bool p_snap_2d_vertices_to_pixel, bool & r_sdf_used) Line 549	C++
godot.windows.editor.dev.x86_64.exe!RendererCanvasCull::_render_canvas_item_tree(RID p_to_render_target, RendererCanvasCull::Canvas::ChildItem * p_child_items, int p_child_item_count, RendererCanvasCull::Item * p_canvas_item, const Transform2D & p_transform, const Rect2 & p_clip_rect, const Color & p_modulate, RendererCanvasRender::Light * p_lights, RendererCanvasRender::Light * p_directional_lights, RenderingServer::CanvasItemTextureFilter p_default_filter, RenderingServer::CanvasItemTextureRepeat p_default_repeat, bool p_snap_2d_vertices_to_pixel, unsigned int canvas_cull_mask) Line 73	C++
godot.windows.editor.dev.x86_64.exe!RendererCanvasCull::render_canvas(RID p_render_target, RendererCanvasCull::Canvas * p_canvas, const Transform2D & p_transform, RendererCanvasRender::Light * p_lights, RendererCanvasRender::Light * p_directional_lights, const Rect2 & p_clip_rect, RenderingServer::CanvasItemTextureFilter p_default_filter, RenderingServer::CanvasItemTextureRepeat p_default_repeat, bool p_snap_2d_transforms_to_pixel, bool p_snap_2d_vertices_to_pixel, unsigned int canvas_cull_mask) Line 382	C++
godot.windows.editor.dev.x86_64.exe!RendererViewport::_draw_viewport(RendererViewport::Viewport * p_viewport) Line 590	C++
godot.windows.editor.dev.x86_64.exe!RendererViewport::draw_viewports(bool p_swap_buffers) Line 772	C++
godot.windows.editor.dev.x86_64.exe!RenderingServerDefault::_draw(bool p_swap_buffers, double frame_step) Line 92	C++
godot.windows.editor.dev.x86_64.exe!RenderingServerDefault::draw(bool p_swap_buffers, double frame_step) Line 387	C++
godot.windows.editor.dev.x86_64.exe!Main::iteration() Line 3648	C++
godot.windows.editor.dev.x86_64.exe!EditorNode::immediate_confirmation_dialog(const String & p_text, const String & p_ok_text, const String & p_cancel_text, unsigned int p_wrap_width) Line 5579	C++
godot.windows.editor.dev.x86_64.exe!SurfaceUpgradeTool::_show_popup() Line 89	C++
godot.windows.editor.dev.x86_64.exe!SurfaceUpgradeTool::_try_show_popup() Line 75	C++
godot.windows.editor.dev.x86_64.exe!RenderingServer::fix_surface_compatibility(RenderingServer::SurfaceData & p_surface, const String & p_path) Line 2138	C++
godot.windows.editor.dev.x86_64.exe!ArrayMesh::_set_surfaces(const Array & p_surfaces) Line 1643	C++
godot.windows.editor.dev.x86_64.exe!call_with_variant_args_helper<ArrayMesh,Array const &,0>(ArrayMesh * p_instance, void(ArrayMesh::*)(const Array &) p_method, const Variant * * p_args, Callable::CallError & r_error, IndexSequence<0> __formal) Line 303	C++
godot.windows.editor.dev.x86_64.exe!call_with_variant_args_dv<ArrayMesh,Array const &>(ArrayMesh * p_instance, void(ArrayMesh::*)(const Array &) p_method, const Variant * * p_args, int p_argcount, Callable::CallError & r_error, const Vector<Variant> & default_values) Line 451	C++
godot.windows.editor.dev.x86_64.exe!MethodBindT<ArrayMesh,Array const &>::call(Object * p_object, const Variant * * p_args, int p_arg_count, Callable::CallError & r_error) Line 337	C++
godot.windows.editor.dev.x86_64.exe!ClassDB::set_property(Object * p_object, const StringName & p_property, const Variant & p_value, bool * r_valid) Line 1235	C++
godot.windows.editor.dev.x86_64.exe!Object::set(const StringName & p_name, const Variant & p_value, bool * r_valid) Line 257	C++
godot.windows.editor.dev.x86_64.exe!ResourceLoaderBinary::load() Line 836	C++
godot.windows.editor.dev.x86_64.exe!ResourceFormatLoaderBinary::load(const String & p_path, const String & p_original_path, Error * r_error, bool p_use_sub_threads, float * r_progress, ResourceFormatLoader::CacheMode p_cache_mode) Line 1198	C++
godot.windows.editor.dev.x86_64.exe!ResourceLoader::_load(const String & p_path, const String & p_original_path, const String & p_type_hint, ResourceFormatLoader::CacheMode p_cache_mode, Error * r_error, bool p_use_sub_threads, float * r_progress) Line 261	C++
godot.windows.editor.dev.x86_64.exe!ResourceLoader::_thread_load_function(void * p_userdata) Line 319	C++
godot.windows.editor.dev.x86_64.exe!ResourceLoader::_load_start(const String & p_path, const String & p_type_hint, ResourceLoader::LoadThreadMode p_thread_mode, ResourceFormatLoader::CacheMode p_cache_mode) Line 501	C++
godot.windows.editor.dev.x86_64.exe!ResourceLoader::load(const String & p_path, const String & p_type_hint, ResourceFormatLoader::CacheMode p_cache_mode, Error * r_error) Line 418	C++
godot.windows.editor.dev.x86_64.exe!EditorResourcePreviewGenerator::generate_from_path(const String & p_path, const Vector2 & p_size, Dictionary & p_metadata) Line 68	C++
godot.windows.editor.dev.x86_64.exe!EditorResourcePreview::_generate_preview(Ref<ImageTexture> & r_texture, Ref<ImageTexture> & r_small_texture, const EditorResourcePreview::QueueItem & p_item, const String & cache_base, Dictionary & p_metadata) Line 159	C++
godot.windows.editor.dev.x86_64.exe!EditorResourcePreview::_iterate() Line 251	C++
godot.windows.editor.dev.x86_64.exe!EditorResourcePreview::_thread() Line 338	C++
godot.windows.editor.dev.x86_64.exe!EditorResourcePreview::_thread_func(void * ud) Line 103	C++
godot.windows.editor.dev.x86_64.exe!Thread::callback(unsigned __int64 p_caller_id, const Thread::Settings & p_settings, void(*)(void *) p_callback, void * p_userdata) Line 63	C++
[External Code]	
godot.windows.editor.dev.x86_64.exe!thread_start<unsigned int (__cdecl*)(void *),1>(void * const parameter) Line 97	C++
[External Code]	
```

### Steps to reproduce

There's a demo project at https://github.com/Malcolmnixon/TiltFiveMapTest which produces the problem.

The first time its loaded without a .godot folder there are a bunch of assert failures on in vhacdVolume.h line 365.

### Minimal reproduction project

The link in the reproduce steps does it. I'm not sure about making anything smaller as it seems to require special circumstances to occur.
MutexLock lock(mutex);
	if (EditorNode::get_singleton()->is_project_exporting()) {
		return; 
	}
	if (!show_requested || popped_up) {
		return;
	}
	show_requested = false;
	popped_up = true;
	const String confirmation_message = TTR("This project uses meshes with an outdated mesh format from previous Godot versions. The engine needs to update the format in order to use those meshes.\n\nPress 'Restart & Upgrade' to run the surface upgrade tool which will update and re-save all meshes and scenes. This update will restart the editor and may take several minutes. Upgrading will make the meshes incompatible with previous versions of Godot.\n\nPress 'Upgrade Only' to continue opening the scene as normal. The engine will update each mesh in memory, but the update will not be saved. Choosing this option will lead to slower load times every time this project is loaded.");
	bool accepted = EditorNode::immediate_confirmation_dialog(confirmation_message, TTR("Restart & Upgrade"), TTR("Upgrade Only"), 500);
	if (accepted) {
		prepare_upgrade();
	} else {
		RS::get_singleton()->set_warn_on_surface_upgrade(true);
	}
}
void SurfaceUpgradeTool::prepare_upgrade() {