1
0
Fork 0
mirror of https://github.com/ocornut/imgui.git synced 2026-01-11 00:04:24 +00:00

Fixed memory unaligned read while reading font from memory for Emscripten

This commit is contained in:
Michel Courtine 2014-11-14 07:47:27 +01:00
parent 56bb993d63
commit 0463d6958b

View file

@ -4866,7 +4866,12 @@ bool ImBitmapFont::LoadFromMemory(const void* data, int data_size)
{
const unsigned char block_type = *(unsigned char*)p;
p += sizeof(unsigned char);
#ifdef __EMSCRIPTEN__
ImU32 block_size;
memcpy(&block_size, p, sizeof(ImU32));
#else
const ImU32 block_size = *(ImU32*)p;
#endif
p += sizeof(ImU32);
switch (block_type)