From c8cc973888e6d1148264f619c85fea93ca2f1b7c Mon Sep 17 00:00:00 2001 From: Hermet Park Date: Fri, 24 Sep 2021 11:53:46 +0900 Subject: [PATCH] tvg_loader: resolve sanitizer report. "runtime error: load of misaligned address 0x7fb67895c815 for type 'unsigned int', which requires 4 byte alignment" This is actually not an issue but we can resolve it with an easy workaround, since we don't need to see this report repeatedly. --- src/loaders/tvg/tvgTvgLoader.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/loaders/tvg/tvgTvgLoader.cpp b/src/loaders/tvg/tvgTvgLoader.cpp index 6f3ab0c0..d7f31844 100644 --- a/src/loaders/tvg/tvgTvgLoader.cpp +++ b/src/loaders/tvg/tvgTvgLoader.cpp @@ -79,18 +79,18 @@ bool TvgLoader::readHeader() //5. Compressed Size if any if (compressed) { - auto p = reinterpret_cast(const_cast(ptr)); + auto p = ptr; //TVG_HEADER_UNCOMPRESSED_SIZE - uncompressedSize = *static_cast(p); - ++p; + memcpy(&uncompressedSize, p, sizeof(uint32_t)); + p += SIZE(uint32_t); //TVG_HEADER_COMPRESSED_SIZE - compressedSize = *static_cast(p); - ++p; + memcpy(&compressedSize, p, sizeof(uint32_t)); + p += SIZE(uint32_t); //TVG_HEADER_COMPRESSED_SIZE_BITS - compressedSizeBits = *static_cast(p); + memcpy(&compressedSizeBits, p, sizeof(uint32_t)); } ptr += TVG_HEADER_COMPRESS_SIZE;