Cap the buffer size in sceAtracSetDataAndGetID().

Not sure if this should be done in the others or not...
This commit is contained in:
Unknown W. Brackets 2013-10-30 07:55:47 -07:00
parent 696aa0f974
commit 8d3ba58936

View File

@ -1236,7 +1236,13 @@ u32 sceAtracSetData(int atracID, u32 buffer, u32 bufferSize) {
}
}
int sceAtracSetDataAndGetID(u32 buffer, u32 bufferSize) {
int sceAtracSetDataAndGetID(u32 buffer, int bufferSize) {
// A large value happens in Tales of VS, and isn't handled somewhere properly as a u32.
// It's impossible for it to be that big anyway, so cap it.
if (bufferSize < 0) {
WARN_LOG(ME, "sceAtracSetDataAndGetID(%08x, %08x): negative bufferSize", buffer, bufferSize);
bufferSize = 0x10000000;
}
int codecType = getCodecType(buffer);
Atrac *atrac = new Atrac();
@ -1846,7 +1852,7 @@ const HLEFunction sceAtrac3plus[] = {
{0x3f6e26b5,WrapU_IUUU<sceAtracSetHalfwayBuffer>,"sceAtracSetHalfwayBuffer"},
{0x83bf7afd,WrapU_IUU<sceAtracSetSecondBuffer>,"sceAtracSetSecondBuffer"},
{0x0E2A73AB,WrapU_IUU<sceAtracSetData>,"sceAtracSetData"}, //?
{0x7a20e7af,WrapI_UU<sceAtracSetDataAndGetID>,"sceAtracSetDataAndGetID"},
{0x7a20e7af,WrapI_UI<sceAtracSetDataAndGetID>,"sceAtracSetDataAndGetID"},
{0xd1f59fdb,WrapU_V<sceAtracStartEntry>,"sceAtracStartEntry"},
{0x868120b5,WrapU_II<sceAtracSetLoopNum>,"sceAtracSetLoopNum"},
{0x132f1eca,WrapI_II<sceAtracReinit>,"sceAtracReinit"},