From 724a4f4676586d65b718deab7f04f207e0ad6488 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 7 Oct 2020 21:48:59 +1100 Subject: Fix T81226: Crash opening 64bit files with endian switching Endian switching when loading 64bit blend files on a 64bit system was crashing as the endian switching is only applicable when loading on 32 bit systems. This crash goes back to 2.7x, it looks like this never worked all the way back to the first commit. --- source/blender/makesdna/intern/dna_genfile.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'source/blender') diff --git a/source/blender/makesdna/intern/dna_genfile.c b/source/blender/makesdna/intern/dna_genfile.c index 511f9f354c9..d7360c67210 100644 --- a/source/blender/makesdna/intern/dna_genfile.c +++ b/source/blender/makesdna/intern/dna_genfile.c @@ -1030,8 +1030,12 @@ void DNA_struct_switch_endian(const SDNA *oldsdna, int oldSDNAnr, char *data) else { /* non-struct field type */ if (ispointer(name)) { - if (oldsdna->pointer_size == 8) { - BLI_endian_switch_int64_array((int64_t *)cur, old_name_array_len); + /* See readfile.c (#bh4_from_bh8 swap endian argument), + * this is only done when reducing the size of a pointer from 4 to 8. */ + if (sizeof(void *) < 8) { + if (oldsdna->pointer_size == 8) { + BLI_endian_switch_int64_array((int64_t *)cur, old_name_array_len); + } } } else { -- cgit v1.2.3