mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Fix a couple bad bounds checks in VAG/Mpeg.
This commit is contained in:
parent
e3e5b24bf8
commit
3931f07852
2 changed files with 3 additions and 3 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue