Ensure aligned copy in tga_read_short

ASAN says:

bitmap/tga.cpp:191:5: runtime error: load of misaligned address 0x51e000003081 for type 'int16_t', which requires 2 byte alignment
This commit is contained in:
Jan Engelhardt 2024-08-30 03:10:28 +02:00
parent 2db85ca6ec
commit 59a6daa2fc

View File

@ -188,7 +188,7 @@ inline int16_t tga_read_short() {
return 0;
}
i = *(int16_t *)(Tga_file_data + Fake_pos);
memcpy(&i, Tga_file_data + Fake_pos, sizeof(i));
Fake_pos += 2;
return INTEL_SHORT(i);