From 7cf69128ea19d45524fbce5a39a7b653d39dbac9 Mon Sep 17 00:00:00 2001 From: misson20000 Date: Sun, 22 Nov 2020 18:00:17 -0800 Subject: [PATCH 1/2] Actually fix time_t decoding crash on Linux --- source/views/view_data_inspector.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/views/view_data_inspector.cpp b/source/views/view_data_inspector.cpp index 8226b5290..185adab26 100644 --- a/source/views/view_data_inspector.cpp +++ b/source/views/view_data_inspector.cpp @@ -92,7 +92,7 @@ namespace hex { auto endianAdjustedTime = hex::changeEndianess(this->m_previewData.time, this->m_endianess); std::tm * ptm = localtime(&endianAdjustedTime); char buffer[64]; - if (std::strftime(buffer, 64, "%a, %d.%m.%Y %H:%M:%S", ptm) != 0) + if (ptm != nullptr && std::strftime(buffer, 64, "%a, %d.%m.%Y %H:%M:%S", ptm) != 0) this->m_cachedData.emplace_back("time_t", buffer); else this->m_cachedData.emplace_back("time_t", "Invalid"); From 01eeb53af0e88b35e96fe1a28145e6f5541a525e Mon Sep 17 00:00:00 2001 From: misson20000 Date: Sun, 22 Nov 2020 18:00:46 -0800 Subject: [PATCH 2/2] Fix out-of-bounds vector write on copy hex string --- source/views/view_hexeditor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/views/view_hexeditor.cpp b/source/views/view_hexeditor.cpp index 7367c53a0..5b8819a9f 100644 --- a/source/views/view_hexeditor.cpp +++ b/source/views/view_hexeditor.cpp @@ -137,7 +137,7 @@ namespace hex { size_t copySize = (end - start) + 1; - std::string buffer; + std::string buffer(copySize, 0x00); buffer.reserve(copySize + 1); this->m_dataProvider->read(start, buffer.data(), copySize);