From daa114aafa416a091fdedec1a9b37d13fbbbecb3 Mon Sep 17 00:00:00 2001 From: Hermet Park Date: Fri, 24 Sep 2021 12:04:31 +0900 Subject: [PATCH] tvg_saver: resolve sanitizer report. "runtime error: load of misaligned address 0x7fb67895c815 for type 'unsigned int', which requires 4 byte alignment" same to c8cc973888e6d1148264f619c85fea93ca2f1b7c --- src/savers/tvg/tvgTvgSaver.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/savers/tvg/tvgTvgSaver.cpp b/src/savers/tvg/tvgTvgSaver.cpp index e882bc29..2d37319a 100644 --- a/src/savers/tvg/tvgTvgSaver.cpp +++ b/src/savers/tvg/tvgTvgSaver.cpp @@ -164,15 +164,15 @@ bool TvgSaver::saveEncoding(const std::string& path) uncompressed += TVG_HEADER_RESERVED_LENGTH; //Uncompressed Size - *reinterpret_cast(uncompressed) = uncompressedSize; + memcpy(uncompressed, &uncompressedSize, TVG_HEADER_UNCOMPRESSED_SIZE); uncompressed += TVG_HEADER_UNCOMPRESSED_SIZE; //Comprssed Size - *reinterpret_cast(uncompressed) = compressedSize; + memcpy(uncompressed, &compressedSize, TVG_HEADER_COMPRESSED_SIZE); uncompressed += TVG_HEADER_COMPRESSED_SIZE; //Compressed Size Bits - *reinterpret_cast(uncompressed) = compressedSizeBits; + memcpy(uncompressed, &compressedSizeBits, TVG_HEADER_COMPRESSED_SIZE_BITS); //Good optimization, flush to file. auto fp = fopen(path.c_str(), "w+");