From 7f64bb193f3d75e5dbfe18281f6d43cad14598c4 Mon Sep 17 00:00:00 2001 From: Leviathan3DPrinting Date: Fri, 10 May 2024 13:42:00 -0500 Subject: [PATCH 1/2] fix a compilation issue --- ion/src/shared/decompress.cpp | 7 ++++++- ion/src/simulator/linux/platform_language.cpp | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ion/src/shared/decompress.cpp b/ion/src/shared/decompress.cpp index f06c311056e..a0b8f57cad6 100644 --- a/ion/src/shared/decompress.cpp +++ b/ion/src/shared/decompress.cpp @@ -4,5 +4,10 @@ void Ion::decompress(const uint8_t * src, uint8_t * dst, int srcSize, int dstSize) { int outputSize = LZ4_decompress_safe(reinterpret_cast(src), reinterpret_cast(dst), srcSize, dstSize); (void)outputSize; // Make the compiler happy if assertions are disabled - assert(outputSize == dstSize); + if (outputSize < 0 || outputSize <= dstSize) { // Check the data came back valid + outputSize = LZ4_decompress_safe(reinterpret_cast(src), reinterpret_cast(dst), srcSize, dstSize); + } + else { + assert(outputSize == dstSize); + } } diff --git a/ion/src/simulator/linux/platform_language.cpp b/ion/src/simulator/linux/platform_language.cpp index 81a370de320..58442afe545 100644 --- a/ion/src/simulator/linux/platform_language.cpp +++ b/ion/src/simulator/linux/platform_language.cpp @@ -8,7 +8,7 @@ namespace Platform { const char * languageCode() { static char buffer[3] = {0}; char * locale = setlocale(LC_ALL, ""); - if (locale[2] == '_') { + if (locale && locale[2] == '_') { // Check if locale is not null before accessing its elements buffer[0] = locale[0]; buffer[1] = locale[1]; return buffer; From 81675bc15f514997d0d18402101655780b501816 Mon Sep 17 00:00:00 2001 From: Leviathan3DPrinting Date: Fri, 10 May 2024 16:31:32 -0500 Subject: [PATCH 2/2] revert file --- ion/src/shared/decompress.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/ion/src/shared/decompress.cpp b/ion/src/shared/decompress.cpp index a0b8f57cad6..f06c311056e 100644 --- a/ion/src/shared/decompress.cpp +++ b/ion/src/shared/decompress.cpp @@ -4,10 +4,5 @@ void Ion::decompress(const uint8_t * src, uint8_t * dst, int srcSize, int dstSize) { int outputSize = LZ4_decompress_safe(reinterpret_cast(src), reinterpret_cast(dst), srcSize, dstSize); (void)outputSize; // Make the compiler happy if assertions are disabled - if (outputSize < 0 || outputSize <= dstSize) { // Check the data came back valid - outputSize = LZ4_decompress_safe(reinterpret_cast(src), reinterpret_cast(dst), srcSize, dstSize); - } - else { - assert(outputSize == dstSize); - } + assert(outputSize == dstSize); }