mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-23 02:11:38 +00:00
Safety check
svn-id: r14804
This commit is contained in:
parent
4c732d15c6
commit
75fd690c20
@ -210,7 +210,7 @@ void Sound::playSound(int soundID, int offset) {
|
||||
size = musicFile.readUint32LE();
|
||||
|
||||
if (music_offs > total_size || (size + music_offs) > total_size) {
|
||||
warning("Bad music offsets");
|
||||
warning("playSound: Bad music offsets");
|
||||
musicFile.close();
|
||||
return;
|
||||
}
|
||||
@ -269,7 +269,13 @@ void Sound::playSound(int soundID, int offset) {
|
||||
if (READ_UINT32(ptr) != MKID('SDAT'))
|
||||
return; // abort
|
||||
|
||||
size = READ_BE_UINT32(ptr+4) - offset - 8;
|
||||
size = READ_BE_UINT32(ptr+4) - 8;
|
||||
if (offset > size) {
|
||||
warning("playSound: Bad sound offset");
|
||||
offset = 0;
|
||||
}
|
||||
size -= offset;
|
||||
|
||||
if (_overrideFreq) {
|
||||
// Used by the piano in Fatty Bear's Birthday Surprise
|
||||
rate = _overrideFreq;
|
||||
|
Loading…
Reference in New Issue
Block a user