Skip to content

Commit

Permalink
[Fix] mpt/io_read/filedata_base_unseekable.hpp: Avoid integer overflo…
Browse files Browse the repository at this point in the history
…w in EnsureCacheBuffer() when reading unseekable files are close to uint32_max in size.

git-svn-id: https://source.openmpt.org/svn/openmpt/trunk/OpenMPT@20333 56274372-70c3-4bfc-bfc3-4c3a0b034d27
  • Loading branch information
manxorist committed Mar 15, 2024
1 parent d4d1e05 commit 9a8d50d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/mpt/io_read/filedata_base_unseekable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class FileDataUnseekable : public IFileData {
};

void EnsureCacheBuffer(std::size_t requiredbuffersize) const {
if (cache.size() >= cachesize + requiredbuffersize) {
if (cache.size() - cachesize >= requiredbuffersize) {
return;
}
if (cache.size() == 0) {
Expand Down

0 comments on commit 9a8d50d

Please sign in to comment.