mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-15 23:40:29 +02:00
Fix a couple bad bounds checks in VAG/Mpeg.
This commit is contained in:
1 parent
e3e5b24bf8
commit
3931f07852
2 files changed
+3
-3
No files matched your search
@@ -23,7 +23,7 @@ static const int modeBpp[4] = { 2, 2, 2, 4 };
|
||||
|
||||
void MediaEngine::writeVideoImage(u32 bufferPtr, int frameWidth, int videoPixelMode)
|
||||
{
|
||||
if (videoPixelMode > (int)(sizeof(modeBpp) / sizeof(modeBpp[0])) || videoPixelMode < 0)
|
||||
if (videoPixelMode >= (int)(sizeof(modeBpp) / sizeof(modeBpp[0])) || videoPixelMode < 0)
|
||||
{
|
||||
ERROR_LOG(ME, "Unexpected videoPixelMode %d, using 0 instead.", videoPixelMode);
|
||||
videoPixelMode = 0;
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user