From 6e9a04117654bc434a15affaf6a3adbd140da320 Mon Sep 17 00:00:00 2001 From: rogerman Date: Fri, 24 Aug 2012 23:09:08 +0000 Subject: [PATCH] movie.cpp: - Fix a buffer overrun bug by disabling reading the ROM checksum in .dsm files for now. (Reading the checksum doesn't work correctly anyways, and nothing currently uses it in practice.) --- desmume/src/movie.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/desmume/src/movie.cpp b/desmume/src/movie.cpp index 95fb868dc..5f2e769bc 100644 --- a/desmume/src/movie.cpp +++ b/desmume/src/movie.cpp @@ -224,8 +224,16 @@ void MovieData::installValue(std::string& key, std::string& val) installInt(val,rerecordCount); else if(key == "romFilename") romFilename = val; - else if(key == "romChecksum") - StringToBytes(val,&romChecksum,MD5DATA::size); + else if(key == "romChecksum") { + // TODO: The current implementation of reading the checksum doesn't work correctly, and can + // cause crashes when the MovieData object is deallocated. (This is caused by StringToBytes() + // overrunning romChecksum into romSerial, making romSerial undefined.) Set romChecksum to + // some dummy value for now to prevent crashing. This is okay, since romChecksum isn't actually + // used in practice at this time. - rogerman, 2012/08/24 + //StringToBytes(val,&romChecksum,MD5DATA::size); + + romChecksum = 0; + } else if(key == "romSerial") romSerial = val; else if(key == "guid")