From a5690f2d193495ab68fd0d941fd4978e0a00f71a Mon Sep 17 00:00:00 2001 From: olszomal Date: Mon, 9 Oct 2023 15:45:10 +0200 Subject: [PATCH] Fixed resource leak, CID 1566947, 1566965, 1566967, 1568542, 1568543 --- appx.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/appx.c b/appx.c index 79a62171..617a1d2d 100644 --- a/appx.c +++ b/appx.c @@ -1798,6 +1798,10 @@ static size_t zipReadFileData(ZIP_FILE *zip, uint8_t **pData, ZIP_CENTRAL_DIRECT compressedData[compressedSize] = 0; } if (entry->compression == COMPRESSION_NONE) { + if (compressedSize == 0) { + OPENSSL_free(compressedData); + return 0; /* FAILED */ + } *pData = compressedData; dataSize = compressedSize; } else if (entry->compression == COMPRESSION_DEFLATE) { @@ -1814,6 +1818,10 @@ static size_t zipReadFileData(ZIP_FILE *zip, uint8_t **pData, ZIP_CENTRAL_DIRECT OPENSSL_free(uncompressedData); return 0; /* FAILED */ } else { + if (destLen == 0) { + OPENSSL_free(uncompressedData); + return 0; /* FAILED */ + } *pData = uncompressedData; dataSize = destLen; }