From: <sv...@op...> - 2024-11-02 15:01:24
|
Author: manx Date: Sat Nov 2 16:01:18 2024 New Revision: 22083 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=22083 Log: [Ref] MP3 Samples: libmpg123: Fix integer overflow when using 64bit internal file offsets. Modified: trunk/OpenMPT/soundlib/SampleFormatMP3.cpp Modified: trunk/OpenMPT/soundlib/SampleFormatMP3.cpp ============================================================================== --- trunk/OpenMPT/soundlib/SampleFormatMP3.cpp Sat Nov 2 15:50:19 2024 (r22082) +++ trunk/OpenMPT/soundlib/SampleFormatMP3.cpp Sat Nov 2 16:01:18 2024 (r22083) @@ -95,7 +95,7 @@ static int FileReaderRead(void *fp, void *buf, size_t count, size_t *returned) { FileReader &file = *static_cast<FileReader *>(fp); - std::size_t readBytes = std::min(count, static_cast<size_t>(file.BytesLeft())); + std::size_t readBytes = std::min(count, mpt::saturate_cast<size_t>(file.BytesLeft())); file.ReadRaw(mpt::span(mpt::void_cast<std::byte*>(buf), readBytes)); if(!returned) { |