From 5b7907beb120a8782f6ce79c886c2ff681a99f5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Heusipp?= Date: Sat, 2 Nov 2024 15:01:18 +0000 Subject: [PATCH] [Ref] MP3 Samples: libmpg123: Fix integer overflow when using 64bit internal file offsets. git-svn-id: https://source.openmpt.org/svn/openmpt/trunk/OpenMPT@22083 56274372-70c3-4bfc-bfc3-4c3a0b034d27 --- soundlib/SampleFormatMP3.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/soundlib/SampleFormatMP3.cpp b/soundlib/SampleFormatMP3.cpp index 676507f024..a77330a7f0 100644 --- a/soundlib/SampleFormatMP3.cpp +++ b/soundlib/SampleFormatMP3.cpp @@ -95,7 +95,7 @@ class ComponentMPG123 static int FileReaderRead(void *fp, void *buf, size_t count, size_t *returned) { FileReader &file = *static_cast(fp); - std::size_t readBytes = std::min(count, static_cast(file.BytesLeft())); + std::size_t readBytes = std::min(count, mpt::saturate_cast(file.BytesLeft())); file.ReadRaw(mpt::span(mpt::void_cast(buf), readBytes)); if(!returned) {