diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-03-16 23:16:36 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-16 23:16:36 +0100 |
commit | bc7e105821cc1a7b1173bc997aa61b3f5b58430a (patch) | |
tree | 95fbebd9a69d61285ae767c0b51905c9c48dbf5b /core/io | |
parent | 97ce8708e86b4cf17b01f7f8ddfd74e348fbb56c (diff) | |
parent | c28428fe4dcd78886b972afcad6b239a58b4b973 (diff) |
Merge pull request #47079 from W4RH4WK/allow-nullptr-with-zero-length-get-buffer
Allow nullptr with zero length in FileAccess get_buffer
Diffstat (limited to 'core/io')
-rw-r--r-- | core/io/file_access_compressed.cpp | 2 | ||||
-rw-r--r-- | core/io/file_access_encrypted.cpp | 2 | ||||
-rw-r--r-- | core/io/file_access_memory.cpp | 2 | ||||
-rw-r--r-- | core/io/file_access_network.cpp | 2 | ||||
-rw-r--r-- | core/io/file_access_pack.cpp | 2 | ||||
-rw-r--r-- | core/io/file_access_zip.cpp | 2 |
6 files changed, 6 insertions, 6 deletions
diff --git a/core/io/file_access_compressed.cpp b/core/io/file_access_compressed.cpp index ade4b2c1ac..b2440629e3 100644 --- a/core/io/file_access_compressed.cpp +++ b/core/io/file_access_compressed.cpp @@ -286,7 +286,7 @@ uint8_t FileAccessCompressed::get_8() const { } int FileAccessCompressed::get_buffer(uint8_t *p_dst, int p_length) const { - ERR_FAIL_COND_V(!p_dst, -1); + ERR_FAIL_COND_V(!p_dst && p_length > 0, -1); ERR_FAIL_COND_V(p_length < 0, -1); ERR_FAIL_COND_V_MSG(!f, -1, "File must be opened before use."); ERR_FAIL_COND_V_MSG(writing, -1, "File has not been opened in read mode."); diff --git a/core/io/file_access_encrypted.cpp b/core/io/file_access_encrypted.cpp index 133ec18762..8ace897f18 100644 --- a/core/io/file_access_encrypted.cpp +++ b/core/io/file_access_encrypted.cpp @@ -237,7 +237,7 @@ uint8_t FileAccessEncrypted::get_8() const { } int FileAccessEncrypted::get_buffer(uint8_t *p_dst, int p_length) const { - ERR_FAIL_COND_V(!p_dst, -1); + ERR_FAIL_COND_V(!p_dst && p_length > 0, -1); ERR_FAIL_COND_V(p_length < 0, -1); ERR_FAIL_COND_V_MSG(writing, -1, "File has not been opened in read mode."); diff --git a/core/io/file_access_memory.cpp b/core/io/file_access_memory.cpp index 4bab8c1d3d..58670d5246 100644 --- a/core/io/file_access_memory.cpp +++ b/core/io/file_access_memory.cpp @@ -138,7 +138,7 @@ uint8_t FileAccessMemory::get_8() const { } int FileAccessMemory::get_buffer(uint8_t *p_dst, int p_length) const { - ERR_FAIL_COND_V(!p_dst, -1); + ERR_FAIL_COND_V(!p_dst && p_length > 0, -1); ERR_FAIL_COND_V(p_length < 0, -1); ERR_FAIL_COND_V(!data, -1); diff --git a/core/io/file_access_network.cpp b/core/io/file_access_network.cpp index e09c3552ef..31b7d658d0 100644 --- a/core/io/file_access_network.cpp +++ b/core/io/file_access_network.cpp @@ -366,7 +366,7 @@ void FileAccessNetwork::_queue_page(int p_page) const { } int FileAccessNetwork::get_buffer(uint8_t *p_dst, int p_length) const { - ERR_FAIL_COND_V(!p_dst, -1); + ERR_FAIL_COND_V(!p_dst && p_length > 0, -1); ERR_FAIL_COND_V(p_length < 0, -1); //bool eof=false; diff --git a/core/io/file_access_pack.cpp b/core/io/file_access_pack.cpp index 17d54e5cb6..e24dc40166 100644 --- a/core/io/file_access_pack.cpp +++ b/core/io/file_access_pack.cpp @@ -299,7 +299,7 @@ uint8_t FileAccessPack::get_8() const { } int FileAccessPack::get_buffer(uint8_t *p_dst, int p_length) const { - ERR_FAIL_COND_V(!p_dst, -1); + ERR_FAIL_COND_V(!p_dst && p_length > 0, -1); ERR_FAIL_COND_V(p_length < 0, -1); if (eof) { diff --git a/core/io/file_access_zip.cpp b/core/io/file_access_zip.cpp index 5364125abb..586c988974 100644 --- a/core/io/file_access_zip.cpp +++ b/core/io/file_access_zip.cpp @@ -303,7 +303,7 @@ uint8_t FileAccessZip::get_8() const { } int FileAccessZip::get_buffer(uint8_t *p_dst, int p_length) const { - ERR_FAIL_COND_V(!p_dst, -1); + ERR_FAIL_COND_V(!p_dst && p_length > 0, -1); ERR_FAIL_COND_V(p_length < 0, -1); ERR_FAIL_COND_V(!zfile, -1); at_eof = unzeof(zfile); |