Repository: godot
Issue: Crash when opening project in editor [asan]
Labels: bug,topic:rendering,topic:editor,confirmed,crash

### Tested versions

4.3.beta.custom_build. 71699e08c

### System information

Ubuntu 24.04

### Issue description

Opening project with ./godot.san -e crashes with this info
```
==126687==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x504002ed5540 at pc 0x57e73ada7f24 bp 0x7fff9058ce50 sp 0x7fff9058ce40
WRITE of size 8 at 0x504002ed5540 thread T0
    #0 0x57e73ada7f23 in RendererRD::MaterialStorage::MaterialData::update_textures(HashMap<StringName, Variant, HashMapHasherDefault, HashMapComparatorDefault<StringName>, DefaultTypedAllocator<HashMapElement<StringName, Variant> > > const&, HashMap<StringName, HashMap<int, RID, HashMapHasherDefault, HashMapComparatorDefault<int>, DefaultTypedAllocator<HashMapElement<int, RID> > >, HashMapHasherDefault, HashMapComparatorDefault<StringName>, DefaultTypedAllocator<HashMapElement<StringName, HashMap<int, RID, HashMapHasherDefault, HashMapComparatorDefault<int>, DefaultTypedAllocator<HashMapElement<int, RID> > > > > > const&, Vector<ShaderCompiler::GeneratedCode::Texture> const&, RID*, bool, bool) servers/rendering/renderer_rd/storage_rd/material_storage.cpp:950
    #1 0x57e73adac308 in RendererRD::MaterialStorage::MaterialData::update_parameters_uniform_set(HashMap<StringName, Variant, HashMapHasherDefault, HashMapComparatorDefault<StringName>, DefaultTypedAllocator<HashMapElement<StringName, Variant> > > const&, bool, bool, HashMap<StringName, ShaderLanguage::ShaderNode::Uniform, HashMapHasherDefault, HashMapComparatorDefault<StringName>, DefaultTypedAllocator<HashMapElement<StringName, ShaderLanguage::ShaderNode::Uniform> > > const&, unsigned int const*, Vector<ShaderCompiler::GeneratedCode::Texture> const&, HashMap<StringName, HashMap<int, RID, HashMapHasherDefault, HashMapComparatorDefault<int>, DefaultTypedAllocator<HashMapElement<int, RID> > >, HashMapHasherDefault, HashMapComparatorDefault<StringName>, DefaultTypedAllocator<HashMapElement<StringName, HashMap<int, RID, HashMapHasherDefault, HashMapComparatorDefault<int>, DefaultTypedAllocator<HashMapElement<int, RID> > > > > > const&, unsigned int, RID&, RID, unsigned int, bool, bool) servers/rendering/renderer_rd/storage_rd/material_storage.cpp:1038
    #2 0x57e73c38a619 in RendererCanvasRenderRD::CanvasMaterialData::update_parameters(HashMap<StringName, Variant, HashMapHasherDefault, HashMapComparatorDefault<StringName>, DefaultTypedAllocator<HashMapElement<StringName, Variant> > > const&, bool, bool) servers/rendering/renderer_rd/renderer_canvas_render_rd.cpp:2403
    #3 0x57e73adcdcd0 in RendererRD::MaterialStorage::_update_queued_materials() servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2042
    #4 0x57e73b09e052 in RendererRD::Utilities::update_dirty_resources() servers/rendering/renderer_rd/storage_rd/utilities.cpp:253
    #5 0x57e73c18ddd2 in RendererSceneCull::update_dirty_instances() servers/rendering/renderer_scene_cull.cpp:4128
    #6 0x57e73c18ebdf in RendererSceneCull::update() servers/rendering/renderer_scene_cull.cpp:4143
    #7 0x57e73a055789 in RenderingServerDefault::_draw(bool, double) servers/rendering/rendering_server_default.cpp:79
    #8 0x57e73a063222 in RenderingServerDefault::draw(bool, double) servers/rendering/rendering_server_default.cpp:410
    #9 0x57e71fcaa21f in Main::iteration() main/main.cpp:4114
    #10 0x57e72b32c199 in ProgressDialog::_update_ui() editor/progress_dialog.cpp:134
    #11 0x57e72b332152 in ProgressDialog::task_step(String const&, String const&, int, bool) editor/progress_dialog.cpp:223
    #12 0x57e72a78677d in EditorNode::progress_task_step(String const&, String const&, int, bool) editor/editor_node.cpp:4815
    #13 0x57e72a13d08d in EditorProgress::step(String const&, int, bool) editor/editor_node.h:931
    #14 0x57e72a0fe920 in EditorFileSystem::_update_scene_groups() editor/editor_file_system.cpp:1671
    #15 0x57e72a0ff2e7 in EditorFileSystem::_update_pending_scene_groups() editor/editor_file_system.cpp:1685
    #16 0x57e72a0f355b in EditorFileSystem::_notification(int) editor/editor_file_system.cpp:1300
    #17 0x57e72a13c9ef in EditorFileSystem::_notificationv(int, bool) (/home/rafal/Downloads/godot.linuxbsd.editor.dev.x86_64.san+0x4cfe29ef)
    #18 0x57e73ee880fc in Object::notification(int, bool) core/object/object.cpp:903
    #19 0x57e73161448e in SceneTree::_process_group(SceneTree::ProcessGroup*, bool) scene/main/scene_tree.cpp:962
    #20 0x57e73161772a in SceneTree::_process(bool) scene/main/scene_tree.cpp:1039
    #21 0x57e7316066b5 in SceneTree::process(double) scene/main/scene_tree.cpp:526
    #22 0x57e71fca939c in Main::iteration() main/main.cpp:4099
    #23 0x57e71f9991f1 in OS_LinuxBSD::run() platform/linuxbsd/os_linuxbsd.cpp:962
    #24 0x57e71f97803f in main platform/linuxbsd/godot_linuxbsd.cpp:85
    #25 0x75c38c62a1c9 in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
    #26 0x75c38c62a28a in __libc_start_main_impl ../csu/libc-start.c:360
    #27 0x57e71f977ab4 in _start (/home/rafal/Downloads/godot.linuxbsd.editor.dev.x86_64.san+0x4281dab4)

0x504002ed5540 is located 0 bytes to the right of 48-byte region [0x504002ed5510,0x504002ed5540)
allocated by thread T0 here:
    #0 0x75c38d2b3ec7 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145
    #1 0x57e73d303689 in Memory::alloc_static(unsigned long, bool) core/os/memory.cpp:75
    #2 0x57e7256985b1 in Error CowData<RID>::resize<false>(long) core/templates/cowdata.h:340
    #3 0x57e7256895e6 in Vector<RID>::resize(long) core/templates/vector.h:95
    #4 0x57e73adaba05 in RendererRD::MaterialStorage::MaterialData::update_parameters_uniform_set(HashMap<StringName, Variant, HashMapHasherDefault, HashMapComparatorDefault<StringName>, DefaultTypedAllocator<HashMapElement<StringName, Variant> > > const&, bool, bool, HashMap<StringName, ShaderLanguage::ShaderNode::Uniform, HashMapHasherDefault, HashMapComparatorDefault<StringName>, DefaultTypedAllocator<HashMapElement<StringName, ShaderLanguage::ShaderNode::Uniform> > > const&, unsigned int const*, Vector<ShaderCompiler::GeneratedCode::Texture> const&, HashMap<StringName, HashMap<int, RID, HashMapHasherDefault, HashMapComparatorDefault<int>, DefaultTypedAllocator<HashMapElement<int, RID> > >, HashMapHasherDefault, HashMapComparatorDefault<StringName>, DefaultTypedAllocator<HashMapElement<StringName, HashMap<int, RID, HashMapHasherDefault, HashMapComparatorDefault<int>, DefaultTypedAllocator<HashMapElement<int, RID> > > > > > const&, unsigned int, RID&, RID, unsigned int, bool, bool) servers/rendering/renderer_rd/storage_rd/material_storage.cpp:1025
    #5 0x57e73c38a619 in RendererCanvasRenderRD::CanvasMaterialData::update_parameters(HashMap<StringName, Variant, HashMapHasherDefault, HashMapComparatorDefault<StringName>, DefaultTypedAllocator<HashMapElement<StringName, Variant> > > const&, bool, bool) servers/rendering/renderer_rd/renderer_canvas_render_rd.cpp:2403
    #6 0x57e73adcdcd0 in RendererRD::MaterialStorage::_update_queued_materials() servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2042
    #7 0x57e73b09e052 in RendererRD::Utilities::update_dirty_resources() servers/rendering/renderer_rd/storage_rd/utilities.cpp:253
    #8 0x57e73c18ddd2 in RendererSceneCull::update_dirty_instances() servers/rendering/renderer_scene_cull.cpp:4128
    #9 0x57e73c18ebdf in RendererSceneCull::update() servers/rendering/renderer_scene_cull.cpp:4143
    #10 0x57e73a055789 in RenderingServerDefault::_draw(bool, double) servers/rendering/rendering_server_default.cpp:79
    #11 0x57e73a063222 in RenderingServerDefault::draw(bool, double) servers/rendering/rendering_server_default.cpp:410
    #12 0x57e71fcaa21f in Main::iteration() main/main.cpp:4114
    #13 0x57e72b32c199 in ProgressDialog::_update_ui() editor/progress_dialog.cpp:134
    #14 0x57e72b332152 in ProgressDialog::task_step(String const&, String const&, int, bool) editor/progress_dialog.cpp:223
    #15 0x57e72a78677d in EditorNode::progress_task_step(String const&, String const&, int, bool) editor/editor_node.cpp:4815
    #16 0x57e72a13d08d in EditorProgress::step(String const&, int, bool) editor/editor_node.h:931
    #17 0x57e72a0fe920 in EditorFileSystem::_update_scene_groups() editor/editor_file_system.cpp:1671
    #18 0x57e72a0ff2e7 in EditorFileSystem::_update_pending_scene_groups() editor/editor_file_system.cpp:1685
    #19 0x57e72a0f355b in EditorFileSystem::_notification(int) editor/editor_file_system.cpp:1300
    #20 0x57e72a13c9ef in EditorFileSystem::_notificationv(int, bool) (/home/rafal/Downloads/godot.linuxbsd.editor.dev.x86_64.san+0x4cfe29ef)
    #21 0x57e73ee880fc in Object::notification(int, bool) core/object/object.cpp:903
    #22 0x57e73161448e in SceneTree::_process_group(SceneTree::ProcessGroup*, bool) scene/main/scene_tree.cpp:962
    #23 0x57e73161772a in SceneTree::_process(bool) scene/main/scene_tree.cpp:1039
    #24 0x57e7316066b5 in SceneTree::process(double) scene/main/scene_tree.cpp:526
    #25 0x57e71fca939c in Main::iteration() main/main.cpp:4099
    #26 0x57e71f9991f1 in OS_LinuxBSD::run() platform/linuxbsd/os_linuxbsd.cpp:962
    #27 0x57e71f97803f in main platform/linuxbsd/godot_linuxbsd.cpp:85
    #28 0x75c38c62a1c9 in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
    #29 0x75c38c62a28a in __libc_start_main_impl ../csu/libc-start.c:360

```

### Steps to reproduce

- Download project
- Open it in editor

Latest linux builds with address sanitizers and debug symbols can be downloaded here - https://github.com/qarmin/GodotBuilds/releases/tag/Nightly

### Minimal reproduction project (MRP)

[test.zip](https://github.com/user-attachments/files/15847580/test.zip)