From da886006a052a9f9c697878dfe317a37ef413ba7 Mon Sep 17 00:00:00 2001 From: nfrmtk Date: Sun, 21 Jan 2024 22:24:53 +0300 Subject: [PATCH] add check for negative buffer_size inside start_(de)compression method. --- core/io/stream_peer_gzip.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/core/io/stream_peer_gzip.cpp b/core/io/stream_peer_gzip.cpp index 4daa71a22ac..514bcf59b8e 100644 --- a/core/io/stream_peer_gzip.cpp +++ b/core/io/stream_peer_gzip.cpp @@ -76,6 +76,7 @@ Error StreamPeerGZIP::start_decompression(bool p_is_deflate, int buffer_size) { Error StreamPeerGZIP::_start(bool p_compress, bool p_is_deflate, int buffer_size) { ERR_FAIL_COND_V(ctx != nullptr, ERR_ALREADY_IN_USE); + ERR_FAIL_COND_V_MSG(buffer_size <= 0, ERR_INVALID_PARAMETER, "Invalid buffer size. It should be a positive integer."); clear(); compressing = p_compress; rb.resize(nearest_shift(buffer_size - 1));