Merge pull request #9270 from leoetlino/dtm-gameid-null
Core/Movie: Fix a likely out-of-bounds read for PanicAlertT
This commit is contained in:
commit
41b79a66c7
|
@ -227,10 +227,10 @@ void Init(const BootParameters& boot)
|
||||||
ReadHeader();
|
ReadHeader();
|
||||||
std::thread md5thread(CheckMD5);
|
std::thread md5thread(CheckMD5);
|
||||||
md5thread.detach();
|
md5thread.detach();
|
||||||
if (strncmp(tmpHeader.gameID.data(), SConfig::GetInstance().GetGameID().c_str(), 6))
|
if (tmpHeader.GetGameID() == SConfig::GetInstance().GetGameID())
|
||||||
{
|
{
|
||||||
PanicAlertFmtT("The recorded game ({0}) is not the same as the selected game ({1})",
|
PanicAlertFmtT("The recorded game ({0}) is not the same as the selected game ({1})",
|
||||||
tmpHeader.gameID.data(), SConfig::GetInstance().GetGameID());
|
tmpHeader.GetGameID(), SConfig::GetInstance().GetGameID());
|
||||||
EndPlayInput(false);
|
EndPlayInput(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <string_view>
|
||||||
|
|
||||||
#include "Common/CommonTypes.h"
|
#include "Common/CommonTypes.h"
|
||||||
|
|
||||||
|
@ -63,6 +64,8 @@ static_assert(sizeof(ControllerState) == 8, "ControllerState should be 8 bytes")
|
||||||
#pragma pack(push, 1)
|
#pragma pack(push, 1)
|
||||||
struct DTMHeader
|
struct DTMHeader
|
||||||
{
|
{
|
||||||
|
std::string_view GetGameID() const { return {gameID.data(), gameID.size()}; }
|
||||||
|
|
||||||
std::array<u8, 4> filetype; // Unique Identifier (always "DTM"0x1A)
|
std::array<u8, 4> filetype; // Unique Identifier (always "DTM"0x1A)
|
||||||
|
|
||||||
std::array<char, 6> gameID; // The Game ID
|
std::array<char, 6> gameID; // The Game ID
|
||||||
|
|
Loading…
Reference in New Issue