Skip to content

Commit fd708f4

Browse files
authored
Merge pull request #1828 from BenLubar/guard-unaligned-access
Only check for Godot 4.0 if the pointer is aligned how it would be for the legacy interface.
2 parents 3830fe4 + 05d2ce3 commit fd708f4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/godot.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ GDExtensionBool GDExtensionBinding::init(GDExtensionInterfaceGetProcAddress p_ge
289289

290290
// Make sure we weren't passed the legacy struct.
291291
uint32_t *raw_interface = (uint32_t *)(void *)p_get_proc_address;
292-
if (raw_interface[0] == 4 && raw_interface[1] == 0) {
292+
if (uintptr_t(p_get_proc_address) % alignof(LegacyGDExtensionInterface) == 0 && raw_interface[0] == 4 && raw_interface[1] == 0) {
293293
// Use the legacy interface only to give a nice error.
294294
LegacyGDExtensionInterface *legacy_interface = (LegacyGDExtensionInterface *)p_get_proc_address;
295295
internal::gdextension_interface_print_error = (GDExtensionInterfacePrintError)legacy_interface->print_error;

0 commit comments

Comments
 (0)