From baf465500a15e2cf9a0b1142edc817c62ea5c76a Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sun, 31 Aug 2014 21:13:51 -0700 Subject: [PATCH] Fix a bad iterator dereference in sceMpeg. Though not sure it should actually reach here, let's at least not crash. --- Core/HLE/sceMpeg.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Core/HLE/sceMpeg.cpp b/Core/HLE/sceMpeg.cpp index f44f9a0937..c4dc0c52f8 100644 --- a/Core/HLE/sceMpeg.cpp +++ b/Core/HLE/sceMpeg.cpp @@ -1569,6 +1569,7 @@ int sceMpegGetAtracAu(u32 mpeg, u32 streamId, u32 auAddr, u32 attrAddr) } if (streamInfo == ctx->streamMap.end()) { WARN_LOG_REPORT(ME, "sceMpegGetAtracAu: invalid audio stream %08x", streamId); + // TODO: Why was this changed to not return an error? } // The audio can end earlier than the video does. @@ -1580,7 +1581,9 @@ int sceMpegGetAtracAu(u32 mpeg, u32 streamId, u32 auAddr, u32 attrAddr) // esBuffer is the memory where this au data goes. We don't write the data to memory. // Instead, let's abuse it to keep track of the stream number. - atracAu.esBuffer = streamInfo->second.num; + if (streamInfo != ctx->streamMap.end()) { + atracAu.esBuffer = streamInfo->second.num; + } int result = 0; atracAu.pts = ctx->mediaengine->getAudioTimeStamp() + ctx->mpegFirstTimestamp;