Fix a couple bad bounds checks in VAG/Mpeg.

This commit is contained in:
Unknown W. Brackets committed 2013-05-18 10:19:12 -07:00
1 parent e3e5b24bf8
commit 3931f07852
2 files changed
+3 -3

No files matched your search

+2 -2
View File
@@ -47,7 +47,7 @@ void VagDecoder::DecodeBlock(u8 *&readp) {
int predict_nr = *readp++;
int shift_factor = predict_nr & 0xf;
predict_nr >>= 4;
if (predict_nr >= sizeof(f) / sizeof(s8)) {
if (predict_nr >= sizeof(f) / sizeof(f[0])) {
predict_nr = 0;
}
int flags = *readp++;
@@ -311,7 +311,7 @@ void SasInstance::Mix(u32 outAddr, u32 inAddr, int leftVol, int rightVol) {
break;
case VOICETYPE_PCM:
{
int size = std::min(voice.pcmSize, (int)(numSamples * sizeof(s16)));
u32 size = std::min(voice.pcmSize, (int)(numSamples * sizeof(s16)));
Memory::Memcpy(resampleBuffer + 2, voice.pcmAddr, size);
if (numSamples * sizeof(s16) > size)
memset(resampleBuffer + 2 + voice.pcmSize, 0, numSamples * sizeof(s16) - size);