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;