|
From: <man...@us...> - 2014-02-18 20:42:17
|
Revision: 3737
http://sourceforge.net/p/modplug/code/3737
Author: manxorist
Date: 2014-02-18 20:42:09 +0000 (Tue, 18 Feb 2014)
Log Message:
-----------
[Fix] Fix signed integer overflow in IT sample decompression integrator (found with clang sanitizer).
Modified Paths:
--------------
trunk/OpenMPT/soundlib/ITCompression.cpp
trunk/OpenMPT/soundlib/ITCompression.h
Modified: trunk/OpenMPT/soundlib/ITCompression.cpp
===================================================================
--- trunk/OpenMPT/soundlib/ITCompression.cpp 2014-02-18 19:18:18 UTC (rev 3736)
+++ trunk/OpenMPT/soundlib/ITCompression.cpp 2014-02-18 20:42:09 UTC (rev 3737)
@@ -426,7 +426,7 @@
v -= (topBit << 1);
mem1 += v;
mem2 += mem1;
- static_cast<typename Properties::sample_t *>(target)[writePos] = static_cast<typename Properties::sample_t>(is215 ? mem2 : mem1);
+ static_cast<typename Properties::sample_t *>(target)[writePos] = static_cast<typename Properties::sample_t>(is215 ? (int)mem2 : (int)mem1);
writtenSamples++;
writePos += mptSample.GetNumChannels();
curLength--;
Modified: trunk/OpenMPT/soundlib/ITCompression.h
===================================================================
--- trunk/OpenMPT/soundlib/ITCompression.h 2014-02-18 19:18:18 UTC (rev 3736)
+++ trunk/OpenMPT/soundlib/ITCompression.h 2014-02-18 20:42:09 UTC (rev 3737)
@@ -80,7 +80,7 @@
SmpLength writePos; // Absolut write position in sample (for stereo samples)
SmpLength curLength; // Length of currently processed block
FileReader::off_t dataPos; // Position in input block
- int mem1, mem2; // Integrator memory
+ unsigned int mem1, mem2; // Integrator memory
// Bit reader
int bitPos; // Current bit position in this byte
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|