From b2c73d2b9a4b30d14dec831decce0a4b69aed54a Mon Sep 17 00:00:00 2001 From: Mark Callow Date: Sat, 29 Jan 2022 16:57:02 +0900 Subject: [PATCH] Fix asserts in DeflateZstd so they fire as intended. --- lib/writer2.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/writer2.c b/lib/writer2.c index 75d4b4db57..19389097fc 100644 --- a/lib/writer2.c +++ b/lib/writer2.c @@ -717,17 +717,22 @@ ktxTexture2_DeflateZstd(ktxTexture2* This, ktx_uint32_t compressionLevel) case ZSTD_error_parameter_outOfBound: return KTX_INVALID_VALUE; case ZSTD_error_dstSize_tooSmall: +#ifdef DEBUG + assert(false && "Deflate dstSize too small."); +#else + return KTX_OUT_OF_MEMORY; +#endif case ZSTD_error_workSpace_tooSmall: #ifdef DEBUG - assert(true); // inflatedDataCapacity too small. + assert(false && "Deflate workspace too small."); #else return KTX_OUT_OF_MEMORY; #endif case ZSTD_error_memory_allocation: return KTX_OUT_OF_MEMORY; default: - // The remaining errors look they should only occur during - // decompression but just in case. + // The remaining errors look like they should only + // occur during decompression but just in case. #ifdef DEBUG assert(true); #else