diff options
author | michi_cc <michi_cc@openttd.org> | 2011-09-02 20:16:41 +0000 |
---|---|---|
committer | michi_cc <michi_cc@openttd.org> | 2011-09-02 20:16:41 +0000 |
commit | 65637d89411e96dee5ee9fc2e8a7b3805c4162a2 (patch) | |
tree | 79fdfb3cefba4457d3b81760173c5ca68e359a81 /src/sound.cpp | |
parent | 6c7cbb1d46d266d33e49bd42a52e483296313882 (diff) | |
download | openttd-65637d89411e96dee5ee9fc2e8a7b3805c4162a2.tar.xz |
(svn r22874) -Fix [FS#4747]: Check size of various buffers before allocation. (monoid)
Diffstat (limited to 'src/sound.cpp')
-rw-r--r-- | src/sound.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/sound.cpp b/src/sound.cpp index 283407882..89d22244c 100644 --- a/src/sound.cpp +++ b/src/sound.cpp @@ -110,7 +110,8 @@ static bool SetBankSource(MixerChannel *mc, const SoundEntry *sound) { assert(sound != NULL); - if (sound->file_size == 0) return false; + /* Check for valid sound size. */ + if (sound->file_size == 0 || sound->file_size > ((size_t)-1) - 2) return false; int8 *mem = MallocT<int8>(sound->file_size + 2); /* Add two extra bytes so rate conversion can read these |