Hello community, here is the log from the commit of package libopenmpt for openSUSE:Factory checked in at 2018-05-30 11:41:17 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/libopenmpt (Old) and /work/SRC/openSUSE:Factory/.libopenmpt.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libopenmpt" Wed May 30 11:41:17 2018 rev:8 rq:612641 version:0.3.9 Changes: -------- --- /work/SRC/openSUSE:Factory/libopenmpt/libopenmpt.changes 2018-04-22 14:33:56.777329484 +0200 +++ /work/SRC/openSUSE:Factory/.libopenmpt.new/libopenmpt.changes 2018-05-30 12:31:06.558318478 +0200 @@ -1,0 +2,12 @@ +Mon May 28 10:36:46 UTC 2018 - tchva...@suse.com + +- Up to 0.3.9: + * [Sec] Possible write near address 0 in out-of-memory situations when reading AMS files (r10149). + * [Bug] openmpt123: Fixed build failure in C++17 due to use of removed feature std::random_shuffle. + * STM: Having both Bxx and Cxx commands in a pattern imported the Bxx command incorrectly. + * STM: Last character of sample name was missing. + * Speed up reading of truncated ULT files. + * ULT: Portamento import was sometimes broken. + * The resonant filter was sometimes unstable when combining low-volume samples, low cutoff and high mixing rates. + +------------------------------------------------------------------- Old: ---- libopenmpt-0.3.8+release.autotools.tar.gz New: ---- libopenmpt-0.3.9+release.autotools.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libopenmpt.spec ++++++ --- /var/tmp/diff_new_pack.oDagCL/_old 2018-05-30 12:31:07.250303798 +0200 +++ /var/tmp/diff_new_pack.oDagCL/_new 2018-05-30 12:31:07.254303713 +0200 @@ -21,12 +21,12 @@ %define libopenmpt_modplug libopenmpt_modplug1 %bcond_without mpg123 Name: libopenmpt -Version: 0.3.8 +Version: 0.3.9 Release: 0 Summary: C++ and C library to decode tracker music files License: BSD-3-Clause Group: Productivity/Multimedia/Other -Url: https://lib.openmpt.org/libopenmpt/ +URL: https://lib.openmpt.org/libopenmpt/ Source: https://lib.openmpt.org/files/libopenmpt/src/%{name}-%{version}+release.autotools.tar.gz Source1: baselibs.conf # PATCH-FIX-UPSTREAM: modplug pc file needs to have full path ++++++ libopenmpt-0.3.8+release.autotools.tar.gz -> libopenmpt-0.3.9+release.autotools.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libopenmpt-0.3.8+release.autotools/common/version.cpp new/libopenmpt-0.3.9+release.autotools/common/version.cpp --- old/libopenmpt-0.3.8+release.autotools/common/version.cpp 2018-01-01 08:31:11.000000000 +0100 +++ new/libopenmpt-0.3.9+release.autotools/common/version.cpp 2018-04-11 13:41:27.000000000 +0200 @@ -629,6 +629,13 @@ "http://www.hermannseib.com/english/vsthost.htm\n" "\n" #endif + "Storlek for all the IT compatibility hints and testcases\n" + "as well as the IMF, MDL, OKT and ULT loaders\n" + "http://schismtracker.org/\n" + "\n" + "Sergei \"x0r\" Kolzun for various hints on Scream Tracker 2 compatibility\n" + "https://github.com/viiri/st2play\n" + "\n" "Laurent Cl\xc3\xA9vy for unofficial MO3 documentation and decompression code\n" "https://github.com/lclevy/unmo3\n" "\n" @@ -716,10 +723,6 @@ "https://github.com/kazuho/picojson\n" "\n" #endif - "Storlek for all the IT compatibility hints and testcases\n" - "as well as the IMF, MDL, OKT and ULT loaders\n" - "http://schismtracker.org/\n" - "\n" #ifdef MODPLUG_TRACKER "Lennart Poettering and David Henningsson for RealtimeKit\n" "http://git.0pointer.net/rtkit.git/\n" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libopenmpt-0.3.8+release.autotools/common/versionNumber.h new/libopenmpt-0.3.9+release.autotools/common/versionNumber.h --- old/libopenmpt-0.3.8+release.autotools/common/versionNumber.h 2018-04-08 13:17:57.000000000 +0200 +++ new/libopenmpt-0.3.9+release.autotools/common/versionNumber.h 2018-04-29 08:03:48.000000000 +0200 @@ -19,7 +19,7 @@ #define VER_MAJORMAJOR 1 #define VER_MAJOR 27 #define VER_MINOR 07 -#define VER_MINORMINOR 00 +#define VER_MINORMINOR 02 //Version string. For example "1.17.02.28" #define MPT_VERSION_STR VER_STRINGIZE(VER_MAJORMAJOR) "." VER_STRINGIZE(VER_MAJOR) "." VER_STRINGIZE(VER_MINOR) "." VER_STRINGIZE(VER_MINORMINOR) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libopenmpt-0.3.8+release.autotools/configure new/libopenmpt-0.3.9+release.autotools/configure --- old/libopenmpt-0.3.8+release.autotools/configure 2018-04-08 13:43:11.000000000 +0200 +++ new/libopenmpt-0.3.9+release.autotools/configure 2018-04-29 08:12:57.000000000 +0200 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for libopenmpt 0.3.8+release.autotools. +# Generated by GNU Autoconf 2.69 for libopenmpt 0.3.9+release.autotools. # # Report bugs to <https://bugs.openmpt.org/>. # @@ -590,8 +590,8 @@ # Identity of this package. PACKAGE_NAME='libopenmpt' PACKAGE_TARNAME='libopenmpt' -PACKAGE_VERSION='0.3.8+release.autotools' -PACKAGE_STRING='libopenmpt 0.3.8+release.autotools' +PACKAGE_VERSION='0.3.9+release.autotools' +PACKAGE_STRING='libopenmpt 0.3.9+release.autotools' PACKAGE_BUGREPORT='https://bugs.openmpt.org/' PACKAGE_URL='https://lib.openmpt.org/' @@ -1482,7 +1482,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures libopenmpt 0.3.8+release.autotools to adapt to many kinds of systems. +\`configure' configures libopenmpt 0.3.9+release.autotools to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1553,7 +1553,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of libopenmpt 0.3.8+release.autotools:";; + short | recursive ) echo "Configuration of libopenmpt 0.3.9+release.autotools:";; esac cat <<\_ACEOF @@ -1752,7 +1752,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -libopenmpt configure 0.3.8+release.autotools +libopenmpt configure 0.3.9+release.autotools generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2151,7 +2151,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by libopenmpt $as_me 0.3.8+release.autotools, which was +It was created by libopenmpt $as_me 0.3.9+release.autotools, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -3022,7 +3022,7 @@ # Define the identity of the package. PACKAGE='libopenmpt' - VERSION='0.3.8+release.autotools' + VERSION='0.3.9+release.autotools' cat >>confdefs.h <<_ACEOF @@ -17186,13 +17186,13 @@ -$as_echo "#define MPT_SVNURL \"https://source.openmpt.org/svn/openmpt/tags/libopenmpt-0.3.8\"" >>confdefs.h +$as_echo "#define MPT_SVNURL \"https://source.openmpt.org/svn/openmpt/tags/libopenmpt-0.3.9\"" >>confdefs.h -$as_echo "#define MPT_SVNVERSION \"10047\"" >>confdefs.h +$as_echo "#define MPT_SVNVERSION \"10169\"" >>confdefs.h -$as_echo "#define MPT_SVNDATE \"2018-04-08T11:38:47.886627Z\"" >>confdefs.h +$as_echo "#define MPT_SVNDATE \"2018-04-29T06:08:50.600539Z\"" >>confdefs.h $as_echo "#define MPT_PACKAGE true" >>confdefs.h @@ -22366,7 +22366,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by libopenmpt $as_me 0.3.8+release.autotools, which was +This file was extended by libopenmpt $as_me 0.3.9+release.autotools, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -22433,7 +22433,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -libopenmpt config.status 0.3.8+release.autotools +libopenmpt config.status 0.3.9+release.autotools configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libopenmpt-0.3.8+release.autotools/configure.ac new/libopenmpt-0.3.9+release.autotools/configure.ac --- old/libopenmpt-0.3.8+release.autotools/configure.ac 2018-04-08 13:43:01.000000000 +0200 +++ new/libopenmpt-0.3.9+release.autotools/configure.ac 2018-04-29 08:12:46.000000000 +0200 @@ -1,4 +1,4 @@ -AC_INIT([libopenmpt], [0.3.8+release.autotools], [https://bugs.openmpt.org/], [libopenmpt], [https://lib.openmpt.org/]) +AC_INIT([libopenmpt], [0.3.9+release.autotools], [https://bugs.openmpt.org/], [libopenmpt], [https://lib.openmpt.org/]) AC_PREREQ([2.68]) AC_CONFIG_MACRO_DIR([m4]) @@ -27,9 +27,9 @@ AC_SUBST([LIBOPENMPT_LTVER_REVISION]) AC_SUBST([LIBOPENMPT_LTVER_AGE]) -AC_DEFINE([MPT_SVNURL], ["https://source.openmpt.org/svn/openmpt/tags/libopenmpt-0.3.8"], [svn version]) -AC_DEFINE([MPT_SVNVERSION], ["10047"], [svn version]) -AC_DEFINE([MPT_SVNDATE], ["2018-04-08T11:38:47.886627Z"], [svn date]) +AC_DEFINE([MPT_SVNURL], ["https://source.openmpt.org/svn/openmpt/tags/libopenmpt-0.3.9"], [svn version]) +AC_DEFINE([MPT_SVNVERSION], ["10169"], [svn version]) +AC_DEFINE([MPT_SVNDATE], ["2018-04-29T06:08:50.600539Z"], [svn date]) AC_DEFINE([MPT_PACKAGE], [true], [is package]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libopenmpt-0.3.8+release.autotools/libopenmpt/dox/changelog.md new/libopenmpt-0.3.9+release.autotools/libopenmpt/dox/changelog.md --- old/libopenmpt-0.3.8+release.autotools/libopenmpt/dox/changelog.md 2018-04-08 13:38:01.000000000 +0200 +++ new/libopenmpt-0.3.9+release.autotools/libopenmpt/dox/changelog.md 2018-04-29 08:08:21.000000000 +0200 @@ -5,10 +5,26 @@ For fully detailed change log, please see the source repository directly. This is just a high-level summary. +### libopenmpt 0.3.9 (2018-04-29) + + * [**Sec**] Possible write near address 0 in out-of-memory situations when + reading AMS files (r10149). + + * [**Bug**] openmpt123: Fixed build failure in C++17 due to use of removed + feature `std::random_shuffle`. + + * STM: Having both Bxx and Cxx commands in a pattern imported the Bxx command + incorrectly. + * STM: Last character of sample name was missing. + * Speed up reading of truncated ULT files. + * ULT: Portamento import was sometimes broken. + * The resonant filter was sometimes unstable when combining low-volume + samples, low cutoff and high mixing rates. + ### libopenmpt 0.3.8 (2018-04-08) - * [**Sec**] Possible out-of-bounds memory read with IT / ITP / MO3 files - containing pattern loops (r10028). + * [**Sec**] Possible out-of-bounds memory read with IT and MO3 files + containing many nested pattern loops (r10028). * Keep track of active SFx macro during seeking. * The "note cut" duplicate note action did not volume-ramp the previously @@ -60,7 +76,6 @@ * Tighten M15 and MOD file rejection heuristics. * J2B: Ignore frequency limits from file header. Fixes Medivo.j2b, broken since libopenmpt-0.2.6401-beta17. - * STM: Last character of sample name was missing. * ParamEq plugin center frequency was not limited correctly. * libopenmpt_ext C API was not included in the documentation. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libopenmpt-0.3.8+release.autotools/libopenmpt/libopenmpt_version.h new/libopenmpt-0.3.9+release.autotools/libopenmpt/libopenmpt_version.h --- old/libopenmpt-0.3.8+release.autotools/libopenmpt/libopenmpt_version.h 2018-04-08 13:38:01.000000000 +0200 +++ new/libopenmpt-0.3.9+release.autotools/libopenmpt/libopenmpt_version.h 2018-04-29 08:08:21.000000000 +0200 @@ -19,7 +19,7 @@ /*! \brief libopenmpt minor version number */ #define OPENMPT_API_VERSION_MINOR 3 /*! \brief libopenmpt patch version number */ -#define OPENMPT_API_VERSION_PATCH 8 +#define OPENMPT_API_VERSION_PATCH 9 /*! \brief libopenmpt pre-release tag */ #define OPENMPT_API_VERSION_PREREL "" /*! \brief libopenmpt pre-release flag */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libopenmpt-0.3.8+release.autotools/libopenmpt/libopenmpt_version.mk new/libopenmpt-0.3.9+release.autotools/libopenmpt/libopenmpt_version.mk --- old/libopenmpt-0.3.8+release.autotools/libopenmpt/libopenmpt_version.mk 2018-04-08 13:38:01.000000000 +0200 +++ new/libopenmpt-0.3.9+release.autotools/libopenmpt/libopenmpt_version.mk 2018-04-29 08:08:21.000000000 +0200 @@ -1,8 +1,8 @@ LIBOPENMPT_VERSION_MAJOR=0 LIBOPENMPT_VERSION_MINOR=3 -LIBOPENMPT_VERSION_PATCH=8 +LIBOPENMPT_VERSION_PATCH=9 LIBOPENMPT_VERSION_PREREL= LIBOPENMPT_LTVER_CURRENT=1 -LIBOPENMPT_LTVER_REVISION=8 +LIBOPENMPT_LTVER_REVISION=9 LIBOPENMPT_LTVER_AGE=1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libopenmpt-0.3.8+release.autotools/man/openmpt123.1 new/libopenmpt-0.3.9+release.autotools/man/openmpt123.1 --- old/libopenmpt-0.3.8+release.autotools/man/openmpt123.1 2018-04-08 13:43:01.000000000 +0200 +++ new/libopenmpt-0.3.9+release.autotools/man/openmpt123.1 2018-04-29 08:12:46.000000000 +0200 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.4. -.TH OPENMPT123 "1" "April 2018" "openmpt123 v0.3.8" "User Commands" +.TH OPENMPT123 "1" "April 2018" "openmpt123 v0.3.9" "User Commands" .SH NAME openmpt123 - command line module music player based on libopenmpt .SH SYNOPSIS diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libopenmpt-0.3.8+release.autotools/openmpt123/openmpt123.cpp new/libopenmpt-0.3.9+release.autotools/openmpt123/openmpt123.cpp --- old/libopenmpt-0.3.8+release.autotools/openmpt123/openmpt123.cpp 2018-01-01 08:31:11.000000000 +0100 +++ new/libopenmpt-0.3.9+release.autotools/openmpt123/openmpt123.cpp 2018-04-23 19:20:15.000000000 +0200 @@ -47,6 +47,7 @@ #include <iterator> #include <limits> #include <map> +#include <random> #include <set> #include <sstream> #include <string> @@ -1754,18 +1755,17 @@ } -static std::string get_random_filename(std::set<std::string> & filenames) { - // TODO: actually use a useful random distribution - std::size_t index = std::rand() % filenames.size(); +static std::string get_random_filename( std::set<std::string> & filenames, std::default_random_engine & prng ) { + std::size_t index = std::uniform_int_distribution<std::size_t>( 0, filenames.size() - 1 )( prng ); std::set<std::string>::iterator it = filenames.begin(); std::advance( it, index ); return *it; } -static void render_files( commandlineflags & flags, textout & log, write_buffers_interface & audio_stream ) { +static void render_files( commandlineflags & flags, textout & log, write_buffers_interface & audio_stream, std::default_random_engine & prng ) { if ( flags.randomize ) { - std::random_shuffle( flags.filenames.begin(), flags.filenames.end() ); + std::shuffle( flags.filenames.begin(), flags.filenames.end(), prng ); } try { while ( true ) { @@ -1777,7 +1777,7 @@ if ( shuffle_set.empty() ) { break; } - std::string filename = get_random_filename( shuffle_set ); + std::string filename = get_random_filename( shuffle_set, prng ); try { flags.playlist_index = std::find( flags.filenames.begin(), flags.filenames.end(), filename ) - flags.filenames.begin(); render_file( flags, filename, log, audio_stream ); @@ -2393,7 +2393,10 @@ log.writeout(); - std::srand( static_cast<unsigned int>( std::time( NULL ) ) ); + std::random_device rd; + std::seed_seq seq{ rd(), static_cast<unsigned int>( std::time( NULL ) ) }; + std::default_random_engine prng( seq ); + std::srand( std::uniform_int_distribution<unsigned int>()( prng ) ); switch ( flags.mode ) { case ModeProbe: { @@ -2404,42 +2407,42 @@ } break; case ModeInfo: { void_audio_stream dummy; - render_files( flags, log, dummy ); + render_files( flags, log, dummy, prng ); } break; case ModeUI: case ModeBatch: { if ( flags.use_stdout ) { flags.apply_default_buffer_sizes(); stdout_stream_raii stdout_audio_stream; - render_files( flags, log, stdout_audio_stream ); + render_files( flags, log, stdout_audio_stream, prng ); } else if ( !flags.output_filename.empty() ) { flags.apply_default_buffer_sizes(); file_audio_stream_raii file_audio_stream( flags, flags.output_filename, log ); - render_files( flags, log, file_audio_stream ); + render_files( flags, log, file_audio_stream, prng ); #if defined( MPT_WITH_PULSEAUDIO ) } else if ( flags.driver == "pulseaudio" || flags.driver.empty() ) { pulseaudio_stream_raii pulseaudio_stream( flags, log ); - render_files( flags, log, pulseaudio_stream ); + render_files( flags, log, pulseaudio_stream, prng ); #endif #if defined( MPT_WITH_SDL2 ) } else if ( flags.driver == "sdl2" || flags.driver.empty() ) { sdl2_stream_raii sdl2_stream( flags, log ); - render_files( flags, log, sdl2_stream ); + render_files( flags, log, sdl2_stream, prng ); #endif #if defined( MPT_WITH_SDL ) } else if ( flags.driver == "sdl" || flags.driver.empty() ) { sdl_stream_raii sdl_stream( flags, log ); - render_files( flags, log, sdl_stream ); + render_files( flags, log, sdl_stream, prng ); #endif #if defined( MPT_WITH_PORTAUDIO ) } else if ( flags.driver == "portaudio" || flags.driver.empty() ) { portaudio_stream_raii portaudio_stream( flags, log ); - render_files( flags, log, portaudio_stream ); + render_files( flags, log, portaudio_stream, prng ); #endif #if defined( WIN32 ) } else if ( flags.driver == "waveout" || flags.driver.empty() ) { waveout_stream_raii waveout_stream( flags ); - render_files( flags, log, waveout_stream ); + render_files( flags, log, waveout_stream, prng ); #endif } else { if ( flags.driver.empty() ) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libopenmpt-0.3.8+release.autotools/soundlib/IntMixer.h new/libopenmpt-0.3.9+release.autotools/soundlib/IntMixer.h --- old/libopenmpt-0.3.8+release.autotools/soundlib/IntMixer.h 2017-06-12 12:57:39.000000000 +0200 +++ new/libopenmpt-0.3.9+release.autotools/soundlib/IntMixer.h 2018-04-27 01:26:02.000000000 +0200 @@ -361,8 +361,10 @@ } } + // To avoid a precision loss in the state variables especially with quiet samples at low cutoff and high mix rate, we pre-amplify the sample. +#define MIXING_FILTER_PREAMP 256 // Filter values are clipped to double the input range -#define ClipFilter(x) Clamp<typename Traits::output_t, typename Traits::output_t>(x, int16_min * 2, int16_max * 2) +#define ClipFilter(x) Clamp<typename Traits::output_t, typename Traits::output_t>(x, int16_min * 2 * MIXING_FILTER_PREAMP, int16_max * 2 * MIXING_FILTER_PREAMP) MPT_FORCEINLINE void operator() (typename Traits::outbuf_t &outSample, const ModChannel &chn) { @@ -370,14 +372,15 @@ for(int i = 0; i < Traits::numChannelsIn; i++) { - typename Traits::output_t val = static_cast<typename Traits::output_t>(( - Util::mul32to64(outSample[i], chn.nFilter_A0) + + const auto inputAmp = outSample[i] * MIXING_FILTER_PREAMP; + typename Traits::output_t val = static_cast<typename Traits::output_t>(mpt::rshift_signed( + Util::mul32to64(inputAmp, chn.nFilter_A0) + Util::mul32to64(ClipFilter(fy[i][0]), chn.nFilter_B0) + Util::mul32to64(ClipFilter(fy[i][1]), chn.nFilter_B1) + - (1 << (MIXING_FILTER_PRECISION - 1))) / (1 << MIXING_FILTER_PRECISION)); + (1 << (MIXING_FILTER_PRECISION - 1)), MIXING_FILTER_PRECISION)); fy[i][1] = fy[i][0]; - fy[i][0] = val - (outSample[i] & chn.nFilter_HP); - outSample[i] = val; + fy[i][0] = val - (inputAmp & chn.nFilter_HP); + outSample[i] = val / MIXING_FILTER_PREAMP; } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libopenmpt-0.3.8+release.autotools/soundlib/Load_stm.cpp new/libopenmpt-0.3.9+release.autotools/soundlib/Load_stm.cpp --- old/libopenmpt-0.3.8+release.autotools/soundlib/Load_stm.cpp 2018-02-10 13:48:00.000000000 +0100 +++ new/libopenmpt-0.3.9+release.autotools/soundlib/Load_stm.cpp 2018-04-24 02:18:17.000000000 +0200 @@ -179,7 +179,7 @@ if(sampleHeader.zero != 0 && sampleHeader.zero != 46) // putup10.stm has zero = 46 return false; sampleHeader.ConvertToMPT(Samples[smp]); - mpt::String::Read<mpt::String::nullTerminated>(m_szNames[smp], sampleHeader.filename); + mpt::String::Read<mpt::String::maybeNullTerminated>(m_szNames[smp], sampleHeader.filename); sampleOffsets[smp - 1] = sampleHeader.offset; } @@ -212,7 +212,7 @@ ORDERINDEX breakPos = ORDERINDEX_INVALID; ROWINDEX breakRow = 63; // Candidate row for inserting pattern break - for(int i = 0; i < 64 * 4; i++, m++) + for(unsigned int i = 0; i < 64 * 4; i++, m++) { uint8 note = file.ReadUint8(), insvol, volcmd, cmdinf; switch(note) @@ -226,9 +226,13 @@ m->note = NOTE_NOTECUT; continue; default: - insvol = file.ReadUint8(); - volcmd = file.ReadUint8(); - cmdinf = file.ReadUint8(); + { + uint8 patData[3]; + file.ReadArray(patData); + insvol = patData[0]; + volcmd = patData[1]; + cmdinf = patData[2]; + } break; } @@ -266,16 +270,22 @@ { case CMD_VOLUMESLIDE: // Lower nibble always has precedence, and there are no fine slides. - if(m->param & 0x0F) m->param &= 0x0F; - else m->param &= 0xF0; + if(m->param & 0x0F) + m->param &= 0x0F; + else + m->param &= 0xF0; break; case CMD_PATTERNBREAK: m->param = (m->param & 0xF0) * 10 + (m->param & 0x0F); - if(breakRow > m->param) + if(breakPos != ORDERINDEX_INVALID && m->param == 0) { - breakRow = m->param; + // Merge Bxx + C00 into just Bxx + m->command = CMD_POSITIONJUMP; + m->param = static_cast<ModCommand::PARAM>(breakPos); + breakPos = ORDERINDEX_INVALID; } + LimitMax(breakRow, i / 4u); break; case CMD_POSITIONJUMP: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libopenmpt-0.3.8+release.autotools/soundlib/Load_ult.cpp new/libopenmpt-0.3.9+release.autotools/soundlib/Load_ult.cpp --- old/libopenmpt-0.3.8+release.autotools/soundlib/Load_ult.cpp 2017-09-24 09:24:38.000000000 +0200 +++ new/libopenmpt-0.3.9+release.autotools/soundlib/Load_ult.cpp 2018-04-12 19:54:19.000000000 +0200 @@ -85,6 +85,17 @@ MPT_BINARY_STRUCT(UltSample, 66) +struct UltPatternCommand +{ + uint8 instr; + uint8 cmd; + uint8 param1; + uint8 param2; +}; + +MPT_BINARY_STRUCT(UltPatternCommand, 4) + + /* Unhandled effects: 5x1 - do not loop sample (x is unused) 9xx - set sample offset to xx * 1024 @@ -215,13 +226,14 @@ b = file.ReadUint8(); } - m.note = (b > 0 && b < 61) ? b + 36 : NOTE_NONE; - m.instr = file.ReadUint8(); - b = file.ReadUint8(); - cmd1 = b & 0x0F; - cmd2 = b >> 4; - param1 = file.ReadUint8(); - param2 = file.ReadUint8(); + m.note = (b > 0 && b < 61) ? (b + 35 + NOTE_MIN) : NOTE_NONE; + UltPatternCommand patCmd; + file.ReadStruct(patCmd); + m.instr = patCmd.instr; + cmd1 = patCmd.cmd & 0x0F; + cmd2 = patCmd.cmd >> 4; + param1 = patCmd.param1; + param2 = patCmd.param2; TranslateULTCommands(cmd1, param1, version); TranslateULTCommands(cmd2, param2, version); @@ -295,7 +307,7 @@ // Apply porta? if(m.note == NOTE_NONE && isPortaActive[curChannel]) { - if(m.command == CMD_NONE && m.vol != VOLCMD_TONEPORTAMENTO) + if(m.command == CMD_NONE && m.volcmd != VOLCMD_TONEPORTAMENTO) { m.command = CMD_TONEPORTAMENTO; m.param = 0; @@ -345,6 +357,10 @@ return true; } +static uint64 GetHeaderMinimumAdditionalSize(const UltFileHeader &fileHeader) +{ + return fileHeader.messageLength * 32u; +} CSoundFile::ProbeResult CSoundFile::ProbeFileHeaderULT(MemoryFileReader file, const uint64 *pfilesize) { @@ -357,8 +373,7 @@ { return ProbeFailure; } - MPT_UNREFERENCED_PARAMETER(pfilesize); - return ProbeSuccess; + return ProbeAdditionalSize(file, pfilesize, GetHeaderMinimumAdditionalSize(fileHeader)); } @@ -379,6 +394,10 @@ { return true; } + if(!file.CanRead(mpt::saturate_cast<FileReader::off_t>(GetHeaderMinimumAdditionalSize(fileHeader)))) + { + return false; + } InitializeGlobals(MOD_TYPE_ULT); mpt::String::Read<mpt::String::maybeNullTerminated>(m_songName, fileHeader.songName); @@ -442,12 +461,9 @@ for(CHANNELINDEX chn = 0; chn < m_nChannels; chn++) { ModCommand evnote; - ModCommand *note; - evnote.Clear(); - - for(PATTERNINDEX pat = 0; pat < numPats; pat++) + for(PATTERNINDEX pat = 0; pat < numPats && file.CanRead(5); pat++) { - note = Patterns[pat].GetpModCommand(0, chn); + ModCommand *note = Patterns[pat].GetpModCommand(0, chn); ROWINDEX row = 0; while(row < 64) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libopenmpt-0.3.8+release.autotools/soundlib/Mixer.h new/libopenmpt-0.3.9+release.autotools/soundlib/Mixer.h --- old/libopenmpt-0.3.8+release.autotools/soundlib/Mixer.h 2016-09-24 01:02:20.000000000 +0200 +++ new/libopenmpt-0.3.9+release.autotools/soundlib/Mixer.h 2018-04-12 18:52:10.000000000 +0200 @@ -16,7 +16,7 @@ #ifdef MPT_INTMIXER typedef int32 mixsample_t; -enum { MIXING_FILTER_PRECISION = 16 }; // Fixed point resonant filter bits +enum { MIXING_FILTER_PRECISION = 24 }; // Fixed point resonant filter bits #else typedef float mixsample_t; #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libopenmpt-0.3.8+release.autotools/soundlib/SampleFormats.cpp new/libopenmpt-0.3.9+release.autotools/soundlib/SampleFormats.cpp --- old/libopenmpt-0.3.8+release.autotools/soundlib/SampleFormats.cpp 2018-03-09 22:13:44.000000000 +0100 +++ new/libopenmpt-0.3.9+release.autotools/soundlib/SampleFormats.cpp 2018-04-19 18:03:50.000000000 +0200 @@ -1665,7 +1665,7 @@ } if(!region.name.empty()) { - mpt::String::Copy(m_szNames[smp], region.name); + mpt::String::Copy(m_szNames[smp], mpt::ToCharset(GetCharsetInternal(), mpt::CharsetUTF8, region.name)); } if(!m_szNames[smp][0]) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libopenmpt-0.3.8+release.autotools/soundlib/pattern.h new/libopenmpt-0.3.9+release.autotools/soundlib/pattern.h --- old/libopenmpt-0.3.8+release.autotools/soundlib/pattern.h 2017-09-24 09:24:38.000000000 +0200 +++ new/libopenmpt-0.3.9+release.autotools/soundlib/pattern.h 2018-04-25 17:16:00.000000000 +0200 @@ -133,7 +133,7 @@ const_iterator end() const { return m_ModCommands.end(); } const_iterator cend() const { return m_ModCommands.cend(); } - CPattern(CPatternContainer& patCont) : m_ModCommands(0), m_Rows(64), m_RowsPerBeat(0), m_RowsPerMeasure(0), m_rPatternContainer(patCont) {}; + CPattern(CPatternContainer& patCont) : m_rPatternContainer(patCont) {}; CPattern(const CPattern &) = default; CPattern(CPattern &&) noexcept = default; @@ -148,9 +148,9 @@ //BEGIN: DATA protected: std::vector<ModCommand> m_ModCommands; - ROWINDEX m_Rows; - ROWINDEX m_RowsPerBeat; // patterns-specific time signature. if != 0, this is implicitely set. - ROWINDEX m_RowsPerMeasure; // ditto + ROWINDEX m_Rows = 0; + ROWINDEX m_RowsPerBeat = 0; // patterns-specific time signature. if != 0, this is implicitely set. + ROWINDEX m_RowsPerMeasure = 0; // ditto TempoSwing m_tempoSwing; std::string m_PatternName; CPatternContainer& m_rPatternContainer;