Merge pull request #5449 from sum2012/sce-mp3

avoid invalid memory in sceMp3ReserveMp3Handle
This commit is contained in:
Henrik Rydgård 2014-02-15 14:24:32 +01:00
commit fc9b057d88

View file

@ -323,13 +323,16 @@ u32 sceMp3ReserveMp3Handle(u32 mp3Addr) {
memset(ctx, 0, sizeof(Mp3Context));
ctx->mp3StreamStart = Memory::Read_U64(mp3Addr);
ctx->mp3StreamEnd = Memory::Read_U64(mp3Addr+8);
ctx->mp3Buf = Memory::Read_U32(mp3Addr+16);
ctx->mp3BufSize = Memory::Read_U32(mp3Addr+20);
ctx->mp3PcmBuf = Memory::Read_U32(mp3Addr+24);
ctx->mp3PcmBufSize = Memory::Read_U32(mp3Addr+28);
if (!Memory::IsValidAddress(mp3Addr))
WARN_LOG_REPORT(ME, "sceMp3ReserveMp3Handle(%08x) invalid address",mp3Addr)
else {
ctx->mp3StreamStart = Memory::Read_U64(mp3Addr);
ctx->mp3StreamEnd = Memory::Read_U64(mp3Addr + 8);
ctx->mp3Buf = Memory::Read_U32(mp3Addr + 16);
ctx->mp3BufSize = Memory::Read_U32(mp3Addr + 20);
ctx->mp3PcmBuf = Memory::Read_U32(mp3Addr + 24);
ctx->mp3PcmBufSize = Memory::Read_U32(mp3Addr + 28);
}
ctx->readPosition = ctx->mp3StreamStart;
ctx->mp3MaxSamples = ctx->mp3PcmBufSize / 4 ;