Browse Source

Merge pull request #87448 from nfrmtk/check-buffer-size

Add check for negative `buffer_size` inside `StreamPeerGZIP::start_(de)compression`
Rémi Verschelde 1 year ago
parent
commit
baf75d048c
1 changed files with 1 additions and 0 deletions
  1. 1 0
      core/io/stream_peer_gzip.cpp

+ 1 - 0
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) {
 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(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();
 	clear();
 	compressing = p_compress;
 	compressing = p_compress;
 	rb.resize(nearest_shift(buffer_size - 1));
 	rb.resize(nearest_shift(buffer_size - 1));