From e44b953d9ab0cc0ea9b1ac07315feecc0b3c74d1 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 4 Sep 2020 14:13:44 +0200 Subject: [PATCH] archive/zzip: use zzip_ssize_t to avoid integer overflows --- src/archive/plugins/ZzipArchivePlugin.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/archive/plugins/ZzipArchivePlugin.cxx b/src/archive/plugins/ZzipArchivePlugin.cxx index a13df5108..c4ebbd582 100644 --- a/src/archive/plugins/ZzipArchivePlugin.cxx +++ b/src/archive/plugins/ZzipArchivePlugin.cxx @@ -147,12 +147,12 @@ ZzipInputStream::Read(void *ptr, size_t read_size) { const ScopeUnlock unlock(mutex); - int ret = zzip_file_read(file, ptr, read_size); - if (ret < 0) + zzip_ssize_t nbytes = zzip_file_read(file, ptr, read_size); + if (nbytes < 0) throw std::runtime_error("zzip_file_read() has failed"); offset = zzip_tell(file); - return ret; + return nbytes; } bool