[Pkg-mpd-commits] [pkg-mpd] 01/13: New upstream version 0.19.20

Florian Schlichting fsfs at moszumanska.debian.org
Tue Dec 13 20:46:08 UTC 2016


This is an automated email from the git hooks/post-receive script.

fsfs pushed a commit to branch master
in repository pkg-mpd.

commit 84e3ed33d7eea5980935cd873e771de0f261b2f9
Author: Florian Schlichting <fsfs at debian.org>
Date:   Mon Dec 12 22:26:00 2016 +0100

    New upstream version 0.19.20
---
 Makefile.in                                  |  2 +-
 NEWS                                         | 12 ++++++++
 configure                                    | 22 +++++++-------
 configure.ac                                 |  4 +--
 doc/doxygen.conf                             |  2 +-
 doc/mpdconf.example                          |  2 +-
 doc/protocol.xml                             |  4 +--
 src/LogInit.cxx                              |  2 +-
 src/decoder/plugins/FfmpegDecoderPlugin.cxx  |  2 +-
 src/decoder/plugins/PcmDecoderPlugin.cxx     | 45 ++++++++++++++++++++--------
 src/decoder/plugins/SidplayDecoderPlugin.cxx | 20 ++++++++-----
 src/input/plugins/AlsaInputPlugin.cxx        |  4 +++
 src/output/plugins/AlsaOutputPlugin.cxx      |  3 ++
 src/output/plugins/WinmmOutputPlugin.cxx     |  2 +-
 src/queue/Queue.cxx                          |  7 +++--
 src/storage/CompositeStorage.cxx             | 19 +++++-------
 src/storage/CompositeStorage.hxx             | 11 +++++--
 src/tag/TagItem.hxx                          |  8 +++--
 src/tag/TagPool.cxx                          |  2 +-
 systemd/mpd.service.in                       | 13 ++++++++
 20 files changed, 124 insertions(+), 62 deletions(-)

diff --git a/Makefile.in b/Makefile.in
index 3191677..8515fbb 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -14054,8 +14054,8 @@ maintainer-clean-generic:
 	@echo "it deletes files that may require special tools to rebuild."
 	-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
 @ANDROID_FALSE@@ENABLE_DOCUMENTATION_FALSE at clean-local:
- at ENABLE_DOCUMENTATION_FALSE@install-data-local:
 @ENABLE_DOCUMENTATION_FALSE at uninstall-local:
+ at ENABLE_DOCUMENTATION_FALSE@install-data-local:
 clean: clean-am
 
 clean-am: clean-binPROGRAMS clean-generic clean-local \
diff --git a/NEWS b/NEWS
index 9da6019..6285a33 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,15 @@
+ver 0.19.20 (2016/12/09)
+* protocol
+  - "setprio" re-enqueues old song if priority has been raised
+* decoder
+  - ffmpeg: ignore empty packets
+  - pcm: fix corruption bug with partial frames (after short read)
+  - sidplay: fix playback speed with libsidplayfp
+* output
+  - winmm: fix 8 bit playback
+* fix gcc 7.0 -Wimplicit-fallthrough
+* systemd: paranoid security settings
+
 ver 0.19.19 (2016/08/23)
 * decoder
   - ffmpeg: bug fix for FFmpeg 3.1 support
diff --git a/configure b/configure
index 3b91319..c7fa05e 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for mpd 0.19.19.
+# Generated by GNU Autoconf 2.69 for mpd 0.19.20.
 #
 # Report bugs to <musicpd-dev-team at lists.sourceforge.net>.
 #
@@ -580,8 +580,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='mpd'
 PACKAGE_TARNAME='mpd'
-PACKAGE_VERSION='0.19.19'
-PACKAGE_STRING='mpd 0.19.19'
+PACKAGE_VERSION='0.19.20'
+PACKAGE_STRING='mpd 0.19.20'
 PACKAGE_BUGREPORT='musicpd-dev-team at lists.sourceforge.net'
 PACKAGE_URL=''
 
@@ -1759,7 +1759,7 @@ if test "$ac_init_help" = "long"; then
   # 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 mpd 0.19.19 to adapt to many kinds of systems.
+\`configure' configures mpd 0.19.20 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1830,7 +1830,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of mpd 0.19.19:";;
+     short | recursive ) echo "Configuration of mpd 0.19.20:";;
    esac
   cat <<\_ACEOF
 
@@ -2175,7 +2175,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-mpd configure 0.19.19
+mpd configure 0.19.20
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2628,7 +2628,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by mpd $as_me 0.19.19, which was
+It was created by mpd $as_me 0.19.20, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -2979,7 +2979,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 VERSION_MAJOR=0
 VERSION_MINOR=19
-VERSION_REVISION=19
+VERSION_REVISION=20
 VERSION_EXTRA=0
 
 
@@ -3498,7 +3498,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='mpd'
- VERSION='0.19.19'
+ VERSION='0.19.20'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -20963,7 +20963,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by mpd $as_me 0.19.19, which was
+This file was extended by mpd $as_me 0.19.20, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -21029,7 +21029,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-mpd config.status 0.19.19
+mpd config.status 0.19.20
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
diff --git a/configure.ac b/configure.ac
index e4764c9..67e4fd5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,10 +1,10 @@
 AC_PREREQ(2.60)
 
-AC_INIT(mpd, 0.19.19, musicpd-dev-team at lists.sourceforge.net)
+AC_INIT(mpd, 0.19.20, musicpd-dev-team at lists.sourceforge.net)
 
 VERSION_MAJOR=0
 VERSION_MINOR=19
-VERSION_REVISION=19
+VERSION_REVISION=20
 VERSION_EXTRA=0
 
 AC_CONFIG_SRCDIR([src/Main.cxx])
diff --git a/doc/doxygen.conf b/doc/doxygen.conf
index e8302e3..0325f24 100644
--- a/doc/doxygen.conf
+++ b/doc/doxygen.conf
@@ -31,7 +31,7 @@ PROJECT_NAME           = MPD
 # This could be handy for archiving the generated documentation or
 # if some version control system is used.
 
-PROJECT_NUMBER = 0.19.19
+PROJECT_NUMBER = 0.19.20
 
 # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
 # base path where the generated documentation will be put.
diff --git a/doc/mpdconf.example b/doc/mpdconf.example
index 21d4b41..9b3a628 100644
--- a/doc/mpdconf.example
+++ b/doc/mpdconf.example
@@ -164,7 +164,7 @@
 # Permissions #################################################################
 #
 # If this setting is set, MPD will require password authorization. The password
-# can setting can be specified multiple times for different password profiles.
+# setting can be specified multiple times for different password profiles.
 #
 #password                        "password at read,add,control,admin"
 #
diff --git a/doc/protocol.xml b/doc/protocol.xml
index ac78ab8..c36c29a 100644
--- a/doc/protocol.xml
+++ b/doc/protocol.xml
@@ -66,8 +66,8 @@
         <function>strcpy</function> just fine with UTF-8 encoded
         strings. For example: <returnvalue>OK</returnvalue> encoded in
         UTF-8 is simply <returnvalue>OK</returnvalue>.  For more
-        information on UTF=8:
-        http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8)
+        information on UTF-8:
+        <ulink url="http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8"/>)
       </para>
     </section>
 
diff --git a/src/LogInit.cxx b/src/LogInit.cxx
index 117c6d8..3cd5da0 100644
--- a/src/LogInit.cxx
+++ b/src/LogInit.cxx
@@ -51,7 +51,7 @@ static constexpr Domain log_domain("log");
 
 #ifndef ANDROID
 
-static int out_fd;
+static int out_fd = -1;
 static AllocatedPath out_path = AllocatedPath::Null();
 
 static void redirect_logs(int fd)
diff --git a/src/decoder/plugins/FfmpegDecoderPlugin.cxx b/src/decoder/plugins/FfmpegDecoderPlugin.cxx
index e27ec79..fc28732 100644
--- a/src/decoder/plugins/FfmpegDecoderPlugin.cxx
+++ b/src/decoder/plugins/FfmpegDecoderPlugin.cxx
@@ -643,7 +643,7 @@ FfmpegDecode(Decoder &decoder, InputStream &input,
 			/* end of file */
 			break;
 
-		if (packet.stream_index == audio_stream) {
+		if (packet.size > 0 && packet.stream_index == audio_stream) {
 			cmd = ffmpeg_send_packet(decoder, input,
 						 packet,
 						 *codec_context,
diff --git a/src/decoder/plugins/PcmDecoderPlugin.cxx b/src/decoder/plugins/PcmDecoderPlugin.cxx
index c07a7b9..8e12412 100644
--- a/src/decoder/plugins/PcmDecoderPlugin.cxx
+++ b/src/decoder/plugins/PcmDecoderPlugin.cxx
@@ -23,10 +23,28 @@
 #include "input/InputStream.hxx"
 #include "util/Error.hxx"
 #include "util/ByteReverse.hxx"
+#include "util/StaticFifoBuffer.hxx"
 #include "Log.hxx"
 
+#include <assert.h>
 #include <string.h>
 
+template<typename B>
+static bool
+FillBuffer(Decoder &decoder, InputStream &is, B &buffer)
+{
+	buffer.Shift();
+	auto w = buffer.Write();
+	assert(!w.IsEmpty());
+
+	size_t nbytes = decoder_read(decoder, is, w.data, w.size);
+	if (nbytes == 0 && is.LockIsEOF())
+		return false;
+
+	buffer.Append(nbytes);
+	return true;
+}
+
 static void
 pcm_stream_decode(Decoder &decoder, InputStream &is)
 {
@@ -50,25 +68,27 @@ pcm_stream_decode(Decoder &decoder, InputStream &is)
 	decoder_initialized(decoder, audio_format,
 			    is.IsSeekable(), total_time);
 
+	StaticFifoBuffer<uint8_t, 4096> buffer;
+
 	DecoderCommand cmd;
 	do {
-		char buffer[4096];
-
-		size_t nbytes = decoder_read(decoder, is,
-					     buffer, sizeof(buffer));
-
-		if (nbytes == 0 && is.LockIsEOF())
+		if (!FillBuffer(decoder, is, buffer))
 			break;
 
+		auto r = buffer.Read();
+		/* round down to the nearest frame size, because we
+		   must not pass partial frames to decoder_data() */
+		r.size -= r.size % frame_size;
+		buffer.Consume(r.size);
+
 		if (reverse_endian)
 			/* make sure we deliver samples in host byte order */
-			reverse_bytes_16((uint16_t *)buffer,
-					 (uint16_t *)buffer,
-					 (uint16_t *)(buffer + nbytes));
+			reverse_bytes_16((uint16_t *)r.data,
+					 (uint16_t *)r.data,
+					 (uint16_t *)(r.data + r.size));
 
-		cmd = nbytes > 0
-			? decoder_data(decoder, is,
-				       buffer, nbytes, 0)
+		cmd = !r.IsEmpty()
+			? decoder_data(decoder, is, r.data, r.size, 0)
 			: decoder_get_command(decoder);
 		if (cmd == DecoderCommand::SEEK) {
 			uint64_t frame = decoder_seek_where_frame(decoder);
@@ -76,6 +96,7 @@ pcm_stream_decode(Decoder &decoder, InputStream &is)
 
 			Error error;
 			if (is.LockSeek(offset, error)) {
+				buffer.Clear();
 				decoder_command_finished(decoder);
 			} else {
 				LogError(error);
diff --git a/src/decoder/plugins/SidplayDecoderPlugin.cxx b/src/decoder/plugins/SidplayDecoderPlugin.cxx
index db4070b..8793a41 100644
--- a/src/decoder/plugins/SidplayDecoderPlugin.cxx
+++ b/src/decoder/plugins/SidplayDecoderPlugin.cxx
@@ -354,12 +354,19 @@ sidplay_file_decode(Decoder &decoder, Path path_fs)
 	DecoderCommand cmd;
 	do {
 		short buffer[4096];
-		size_t nbytes;
 
-		nbytes = player.play(buffer, ARRAY_SIZE(buffer));
-		if (nbytes == 0)
+		const auto result = player.play(buffer, ARRAY_SIZE(buffer));
+		if (result <= 0)
 			break;
 
+#ifdef HAVE_SIDPLAYFP
+		/* libsidplayfp returns the number of samples */
+		const size_t nbytes = result * sizeof(buffer[0]);
+#else
+		/* libsidplay2 returns the number of bytes */
+		const size_t nbytes = result;
+#endif
+
 		decoder_timestamp(decoder, (double)player.time() / timebase);
 
 		cmd = decoder_data(decoder, nullptr, buffer, nbytes, 0);
@@ -376,12 +383,9 @@ sidplay_file_decode(Decoder &decoder, Path path_fs)
 			}
 
 			/* ignore data until target time is reached */
-			while(data_time<target_time) {
-				nbytes=player.play(buffer, ARRAY_SIZE(buffer));
-				if(nbytes==0)
-					break;
+			while (data_time < target_time &&
+			       player.play(buffer, ARRAY_SIZE(buffer)) > 0)
 				data_time = player.time();
-			}
 
 			decoder_command_finished(decoder);
 		}
diff --git a/src/input/plugins/AlsaInputPlugin.cxx b/src/input/plugins/AlsaInputPlugin.cxx
index f03f745..e5d1ae0 100644
--- a/src/input/plugins/AlsaInputPlugin.cxx
+++ b/src/input/plugins/AlsaInputPlugin.cxx
@@ -247,6 +247,10 @@ AlsaInputStream::Recover(int err)
 	case -EPIPE:
 		LogDebug(alsa_input_domain, "Buffer Overrun");
 		// drop through
+#if GCC_CHECK_VERSION(7,0)
+		[[fallthrough]];
+#endif
+
 	case -ESTRPIPE:
 	case -EINTR:
 		err = snd_pcm_recover(capture_handle, err, 1);
diff --git a/src/output/plugins/AlsaOutputPlugin.cxx b/src/output/plugins/AlsaOutputPlugin.cxx
index 28c374a..14eaeeb 100644
--- a/src/output/plugins/AlsaOutputPlugin.cxx
+++ b/src/output/plugins/AlsaOutputPlugin.cxx
@@ -760,6 +760,9 @@ alsa_recover(AlsaOutput *ad, int err)
 		if (err == -EAGAIN)
 			return 0;
 		/* fall-through to snd_pcm_prepare: */
+#if GCC_CHECK_VERSION(7,0)
+		[[fallthrough]];
+#endif
 	case SND_PCM_STATE_SETUP:
 	case SND_PCM_STATE_XRUN:
 		ad->period_position = 0;
diff --git a/src/output/plugins/WinmmOutputPlugin.cxx b/src/output/plugins/WinmmOutputPlugin.cxx
index e5c5a6f..1d54aaf 100644
--- a/src/output/plugins/WinmmOutputPlugin.cxx
+++ b/src/output/plugins/WinmmOutputPlugin.cxx
@@ -148,10 +148,10 @@ winmm_output_open(AudioOutput *ao, AudioFormat &audio_format,
 	}
 
 	switch (audio_format.format) {
-	case SampleFormat::S8:
 	case SampleFormat::S16:
 		break;
 
+	case SampleFormat::S8:
 	case SampleFormat::S24_P32:
 	case SampleFormat::S32:
 	case SampleFormat::FLOAT:
diff --git a/src/queue/Queue.cxx b/src/queue/Queue.cxx
index 99b545a..2011b2c 100644
--- a/src/queue/Queue.cxx
+++ b/src/queue/Queue.cxx
@@ -426,14 +426,15 @@ Queue::SetPriority(unsigned position, uint8_t priority, int after_order)
 
 		if (_order < (unsigned)after_order) {
 			/* the specified song has been played already
-			   - enqueue it only if its priority has just
-			   become bigger than the current one's */
+			   - enqueue it only if its priority has been
+			   increased and is now bigger than the
+			   current one's */
 
 			const unsigned after_position =
 				OrderToPosition(after_order);
 			const Item *after_item =
 				&items[after_position];
-			if (old_priority > after_item->priority ||
+			if (priority <= old_priority ||
 			    priority <= after_item->priority)
 				/* priority hasn't become bigger */
 				return true;
diff --git a/src/storage/CompositeStorage.cxx b/src/storage/CompositeStorage.cxx
index ce9c1e8..ba04c8f 100644
--- a/src/storage/CompositeStorage.cxx
+++ b/src/storage/CompositeStorage.cxx
@@ -265,22 +265,13 @@ CompositeStorage::FindStorage(const char *uri) const
 	return result;
 }
 
-CompositeStorage::FindResult
-CompositeStorage::FindStorage(const char *uri, Error &error) const
-{
-	auto result = FindStorage(uri);
-	if (result.directory == nullptr)
-		error.Set(composite_domain, "No such directory");
-	return result;
-}
-
 bool
 CompositeStorage::GetInfo(const char *uri, bool follow, FileInfo &info,
 			  Error &error)
 {
 	const ScopeLock protect(mutex);
 
-	auto f = FindStorage(uri, error);
+	auto f = FindStorage(uri);
 	if (f.directory->storage != nullptr &&
 	    f.directory->storage->GetInfo(f.uri, follow, info, error))
 		return true;
@@ -295,6 +286,8 @@ CompositeStorage::GetInfo(const char *uri, bool follow, FileInfo &info,
 		return true;
 	}
 
+	if (!error.IsDefined())
+		error.Set(composite_domain, "No such directory");
 	return false;
 }
 
@@ -304,13 +297,15 @@ CompositeStorage::OpenDirectory(const char *uri,
 {
 	const ScopeLock protect(mutex);
 
-	auto f = FindStorage(uri, error);
+	auto f = FindStorage(uri);
 	const Directory *directory = f.directory->Find(f.uri);
 	if (directory == nullptr || directory->children.empty()) {
 		/* no virtual directories here */
 
-		if (f.directory->storage == nullptr)
+		if (f.directory->storage == nullptr) {
+			error.Set(composite_domain, "No such directory");
 			return nullptr;
+		}
 
 		return f.directory->storage->OpenDirectory(f.uri, error);
 	}
diff --git a/src/storage/CompositeStorage.hxx b/src/storage/CompositeStorage.hxx
index c3695c7..afe60e2 100644
--- a/src/storage/CompositeStorage.hxx
+++ b/src/storage/CompositeStorage.hxx
@@ -45,7 +45,7 @@ class CompositeStorage final : public Storage {
 	 */
 	struct Directory {
 		/**
-		 * The #Storage mounted n this virtual directory.  All
+		 * The #Storage mounted in this virtual directory.  All
 		 * "leaf" Directory instances must have a #Storage.
 		 * Other Directory instances may have one, and child
 		 * mounts will be "mixed" in.
@@ -155,9 +155,16 @@ private:
 		}
 	}
 
+	/**
+	 * Follow the given URI path, and find the outermost directory
+	 * which is a #Storage mount point.  If there are no mounts,
+	 * it returns the root directory (with a nullptr "storage"
+	 * attribute, of course).  FindResult::uri contains the
+	 * remaining unused part of the URI (may be empty if all of
+	 * the URI was used).
+	 */
 	gcc_pure
 	FindResult FindStorage(const char *uri) const;
-	FindResult FindStorage(const char *uri, Error &error) const;
 
 	const char *MapToRelativeUTF8(const Directory &directory,
 				      const char *uri) const;
diff --git a/src/tag/TagItem.hxx b/src/tag/TagItem.hxx
index 489ecde..ebea73a 100644
--- a/src/tag/TagItem.hxx
+++ b/src/tag/TagItem.hxx
@@ -21,7 +21,6 @@
 #define MPD_TAG_ITEM_HXX
 
 #include "TagType.h"
-#include "Compiler.h"
 
 /**
  * One tag value.  It is a mapping of #TagType to am arbitrary string
@@ -35,11 +34,14 @@ struct TagItem {
 	/**
 	 * the value of this tag; this is a variable length string
 	 */
-	char value[sizeof(long) - sizeof(type)];
+	char value[1];
 
 	TagItem() = default;
 	TagItem(const TagItem &other) = delete;
 	TagItem &operator=(const TagItem &other) = delete;
-} gcc_packed;
+};
+
+static_assert(sizeof(TagItem) == 2, "Unexpected size");
+static_assert(alignof(TagItem) == 1, "Unexpected alignment");
 
 #endif
diff --git a/src/tag/TagPool.cxx b/src/tag/TagPool.cxx
index 16f44f4..22dc2a0 100644
--- a/src/tag/TagPool.cxx
+++ b/src/tag/TagPool.cxx
@@ -50,7 +50,7 @@ struct TagPoolSlot {
 
 	static TagPoolSlot *Create(TagPoolSlot *_next, TagType type,
 				   const char *value, size_t length);
-} gcc_packed;
+};
 
 TagPoolSlot *
 TagPoolSlot::Create(TagPoolSlot *_next, TagType type,
diff --git a/systemd/mpd.service.in b/systemd/mpd.service.in
index 0e8eb84..250ab52 100644
--- a/systemd/mpd.service.in
+++ b/systemd/mpd.service.in
@@ -9,5 +9,18 @@ ExecStart=@prefix@/bin/mpd --no-daemon
 LimitRTPRIO=50
 LimitRTTIME=infinity
 
+# disallow writing to /usr, /bin, /sbin, ...
+ProtectSystem=yes
+
+# more paranoid security settings
+NoNewPrivileges=yes
+ProtectKernelTunables=yes
+ProtectControlGroups=yes
+ProtectKernelModules=yes
+# AF_NETLINK is required by libsmbclient, or it will exit() .. *sigh*
+RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX AF_NETLINK
+RestrictNamespaces=yes
+
 [Install]
 WantedBy=multi-user.target
+Also=mpd.socket

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mpd/pkg-mpd.git



More information about the Pkg-mpd-commits mailing list