forked from mirror/OpenTTD
(svn r22874) -Fix [FS#4747]: Check size of various buffers before allocation. (monoid)
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user