From: <man...@us...> - 2015-03-03 11:42:06
|
Revision: 4810 http://sourceforge.net/p/modplug/code/4810 Author: manxorist Date: 2015-03-03 11:41:53 +0000 (Tue, 03 Mar 2015) Log Message: ----------- [Fix] Skip files too big for UnpackPP20. (fixes 64bit warning) Modified Paths: -------------- trunk/OpenMPT/common/misc_util.h trunk/OpenMPT/soundlib/Mmcmp.cpp Modified: trunk/OpenMPT/common/misc_util.h =================================================================== --- trunk/OpenMPT/common/misc_util.h 2015-03-02 23:07:31 UTC (rev 4809) +++ trunk/OpenMPT/common/misc_util.h 2015-03-03 11:41:53 UTC (rev 4810) @@ -272,7 +272,7 @@ { // Returns true iff Tdst can represent the value val. -// Use as if(Util::TypeCanHold<uin8>(-1)). +// Use as if(Util::TypeCanHoldValue<uint8>(-1)). template <typename Tdst, typename Tsrc> inline bool TypeCanHoldValue(Tsrc val) { Modified: trunk/OpenMPT/soundlib/Mmcmp.cpp =================================================================== --- trunk/OpenMPT/soundlib/Mmcmp.cpp 2015-03-02 23:07:31 UTC (rev 4809) +++ trunk/OpenMPT/soundlib/Mmcmp.cpp 2015-03-03 11:41:53 UTC (rev 4810) @@ -837,6 +837,7 @@ file.Rewind(); unpackedData.clear(); + if(!Util::TypeCanHoldValue<uint32>(file.GetLength())) return false; if(!file.CanRead(PP20_PACKED_SIZE_MIN)) return false; if(!file.ReadMagic("PP20")) return false; file.Seek(file.GetLength() - 4); @@ -847,7 +848,7 @@ if(dstLen == 0) return false; unpackedData.resize(dstLen); file.Seek(4); - bool result = PP20_DoUnpack(reinterpret_cast<const uint8 *>(file.GetRawData()), file.GetLength() - 4, reinterpret_cast<uint8 *>(&(unpackedData[0])), dstLen); + bool result = PP20_DoUnpack(reinterpret_cast<const uint8 *>(file.GetRawData()), static_cast<uint32>(file.GetLength() - 4), reinterpret_cast<uint8 *>(&(unpackedData[0])), dstLen); return result; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |