Repository: godot
Issue: Importing certain images on OSX/Intel will crash both the editor and a release build
Labels: bug,platform:macos,topic:import,crash

### Godot version

3.5.3-stable

### System information

macOS Catalina 10.15.7 Mac mini (Late 2021)

### Issue description

When the project contains certain images, it will segfault when loading on Intel-based OSX - both in the editor and with the release build.

crash of the MRP within the test rig:
```
koder@Mariuszs-Mac-mini godot-osx-intel-crash % ../../Desktop/Godot\ 3.5.3.app/Contents/MacOS/Godot --verbose --editor ../godot-osx-intel-crash/project.godot
arguments
0: ../../Desktop/Godot 3.5.3.app/Contents/MacOS/Godot
1: --verbose
2: --editor
3: ../godot-osx-intel-crash/project.godot
Current path: /Users/koder/projects/godot-osx-intel-crash
2023-10-16 14:14:32.155 Godot[2230:54172] *** +[NSString stringWithUTF8String:]: NULL cString
Godot Engine v3.5.3.stable.official.6c814135b - https://godotengine.org
Using GLES3 video driver
OpenGL debugging not supported!
OpenGL ES 3.0 Renderer: Intel HD Graphics 4000 OpenGL Engine
Async. shader compilation: OFF
OpenGL ES 2D Batching: ON
Batching Options:
    max_join_item_commands 16
    colored_vertex_format_threshold 0.25
    batch_buffer_size 16384
    light_scissor_area_threshold 1
    item_reordering_lookahead 4
    light_max_join_items 32
    single_rect_fallback False
    debug_flash False
    diagnose_frame False
CoreAudio: detected 2 channels
CoreAudio: audio buffer frames: 512 calculated latency: 11ms
 
Unsupported locale 'en_PL', falling back to 'en'.
CORE API HASH: 101963945105872443
EDITOR API HASH: 5924218211260525683
Loading resource: res://default_env.tres
Construct gdnative interface

Destruct gdnative interface

Class 'BulletPhysicsDirectSpaceState' is not exposed, skipping.
Class 'BulletPhysicsServer' is not exposed, skipping.
Class 'EditorPropertyNameProcessor' is not exposed, skipping.
Class 'GDScriptNativeClass' is not exposed, skipping.
Class 'IP_Unix' is not exposed, skipping.
Class 'InputDefault' is not exposed, skipping.
Class 'Physics2DDirectSpaceStateSW' is not exposed, skipping.
Class 'Physics2DServerSW' is not exposed, skipping.
Class 'ResourceImporterMP3' is not exposed, skipping.
Class 'ResourceImporterOGGVorbis' is not exposed, skipping.
Loading resource: /Users/koder/Library/Application Support/Godot/editor_settings-3.tres
EditorSettings: Load OK!
Loaded builtin certs
EditorSettings: Save OK!
ETC: Begin encoding, format: ETC2_RGBA8
ETC: Time encoding: 25016
Loading resource: res://big-moonlet-crawl-pocket-c.png

================================================================
handle_crash: Program crashed with signal 11
Engine version: Godot Engine v3.5.3.stable.official (6c814135b69d4e703956bacc2073b4b179ff5a00)
Dumping the backtrace. Please include this when reporting the bug to the project developer.
[1] 1   libsystem_platform.dylib            0x00007fff689585fd _sigtramp + 29
[2] 2   ???                                 0x0000000000000000 0x0 + 0
[3] 3   AppleIntelHD4000GraphicsGLDriver    0x00007fff244fb452 glrWriteTextureData + 2926
[4] 4   GLEngine                            0x00007fff3956532a glCompressedTexImage2D_Exec + 1612
[5] 5   libGL.dylib                         0x00007fff388ce100 glCompressedTexImage2D + 52
[6] DirAccess* DirAccess::_create_builtin<DirAccessUnix>()
[7] Physics2DServerWrapMT::bodyallocn()
[8] DirAccess* DirAccess::_create_builtin<DirAccessOSX>()
[9] DefaultAllocator::alloc(unsigned long)
[10] DirAccess* DirAccess::_create_builtin<DirAccessOSX>()
[11] 11  libdyld.dylib                       0x00007fff6875bcc9 start + 1
[12] 12  ???                                 0x0000000000000004 0x0 + 4
-- END OF BACKTRACE --
================================================================
zsh: abort      ../../Desktop/Godot\ 3.5.3.app/Contents/MacOS/Godot --verbose --editor
```

game crash, using debug build of 3.5.3:
```
Loading resource: res://FastForward.gdc
Loading resource: res://menu/keybinds/fast-forward.png
[1] 1   libsystem_platform.dylib        	0x00007fff689585fd _sigtramp + 29
[2] 2   ???                             	0x0000000000000000 0x0 + 0
[3] 3   AppleIntelHD4000GraphicsGLDriver	0x00007fff244fb452 glrWriteTextureData + 2926
[4] 4   GLEngine                        	0x00007fff3956532a glCompressedTexImage2D_Exec + 1612
[5] 5   libGL.dylib                     	0x00007fff388ce100 glCompressedTexImage2D + 52
[6] DirAccess* DirAccess::_create_builtin<DirAccessUnix>()
[7] Physics2DServerWrapMT::bodyallocn()
[8] Physics2DServerWrapMT::bodyallocn()
[9] Physics2DServerWrapMT::bodyallocn()
[10] MutexImpl<std::__1::mutex>::try_lock() const
[11] MutexImpl<std::__1::mutex>::try_lock() const
[12] 12  libsystem_pthread.dylib         	0x00007fff68964109 _pthread_start + 148
[13] 13  libsystem_pthread.dylib         	0x00007fff6895fb8b thread_start + 15
-- END OF BACKTRACE --
================================================================
zsh: abort  	./Delta-V.app/Contents/MacOS/Delta-V --verbose
```

editor crash, also 3.5.3-stable:
```
Loading resource: res://story/big-moonlet-crawl-pocket-c.png

================================================================
handle_crash: Program crashed with signal 11
Engine version: Godot Engine v3.5.3.stable.official (6c814135b69d4e703956bacc2073b4b179ff5a00)
Dumping the backtrace. Please include this when reporting the bug on https://discord.gg/YpftnDK
[1] 1   libsystem_platform.dylib        	0x00007fff689585fd _sigtramp + 29
[2] 2   ???                             	0x0000000000000000 0x0 + 0
[3] 3   AppleIntelHD4000GraphicsGLDriver	0x00007fff244fb452 glrWriteTextureData + 2926
[4] 4   GLEngine                        	0x00007fff3956532a glCompressedTexImage2D_Exec + 1612
[5] 5   libGL.dylib                     	0x00007fff388ce100 glCompressedTexImage2D + 52
[6] DirAccess* DirAccess::_create_builtin<DirAccessUnix>()
[7] Physics2DServerWrapMT::bodyallocn()
[8] DirAccess* DirAccess::_create_builtin<DirAccessOSX>()
[9] DefaultAllocator::alloc(unsigned long)
[10] DirAccess* DirAccess::_create_builtin<DirAccessOSX>()
[11] 11  libdyld.dylib                   	0x00007fff6875bcc9 start + 1
-- END OF BACKTRACE --
================================================================
zsh: abort  	./Godot\ 3.5.3.app/Contents/MacOS/Godot --verbose --editor
```

This was reported by multiple players using different MacOS hardware. The apparent common point is that all of them used Intel, but it might also be older OS versions. M1-based systems seem to be not affected.

I have more files that cause this crash with a common size (normal maps and other maps for the same sprite). I suspect the root cause is the size.

### Steps to reproduce

Open the attached MRP on an Intel-based OSX in the editor.

### Minimal reproduction project

[godot-osx-intel-crash.zip](https://github.com/godotengine/godot/files/12916203/godot-osx-intel-crash.zip)