[Pkg-mpd-commits] [pkg-mpd] 01/08: Imported Upstream version 0.19.14

Florian Schlichting fsfs at moszumanska.debian.org
Sun Mar 27 00:28:43 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 e82dfc713f55ab0a2ae0de97273dc51e08c39145
Author: Florian Schlichting <fsfs at debian.org>
Date:   Sat Mar 26 23:36:04 2016 +0100

    Imported Upstream version 0.19.14
---
 Makefile.in                                  |  4 +--
 NEWS                                         |  9 ++++++
 configure                                    | 22 +++++++-------
 configure.ac                                 |  4 +--
 doc/doxygen.conf                             |  2 +-
 src/archive/plugins/Iso9660ArchivePlugin.cxx | 43 +++++++++++++++++-----------
 src/decoder/plugins/DsdiffDecoderPlugin.cxx  |  2 +-
 src/decoder/plugins/OpusReader.hxx           |  2 +-
 src/mixer/plugins/PulseMixerPlugin.cxx       |  2 +-
 src/protocol/ArgParser.cxx                   |  4 +--
 src/tag/TagPool.cxx                          | 22 +++++++-------
 src/thread/PosixCond.hxx                     | 14 ++++-----
 src/thread/PosixMutex.hxx                    | 14 ++++-----
 src/util/HugeAllocator.cxx                   |  2 +-
 14 files changed, 82 insertions(+), 64 deletions(-)

diff --git a/Makefile.in b/Makefile.in
index e24b793..14f4bb4 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -13902,9 +13902,9 @@ maintainer-clean-generic:
 	@echo "This command is intended for maintainers to use"
 	@echo "it deletes files that may require special tools to rebuild."
 	-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
- at ANDROID_FALSE@@ENABLE_DOCUMENTATION_FALSE at clean-local:
- at ENABLE_DOCUMENTATION_FALSE@uninstall-local:
 @ENABLE_DOCUMENTATION_FALSE at install-data-local:
+ at ENABLE_DOCUMENTATION_FALSE@uninstall-local:
+ at ANDROID_FALSE@@ENABLE_DOCUMENTATION_FALSE at clean-local:
 clean: clean-am
 
 clean-am: clean-binPROGRAMS clean-generic clean-local \
diff --git a/NEWS b/NEWS
index 96d8ec8..0762ce4 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,12 @@
+ver 0.19.14 (2016/03/18)
+* decoder
+  - dsdiff: fix off-by-one buffer overflow
+  - opus: limit tag size to 64 kB
+* archive
+  - iso9660: fix buffer overflow
+* fix quadratic runtime bug in the tag pool
+* fix build failures on non-glibc builds due to constexpr Mutex
+
 ver 0.19.13 (2016/02/23)
 * tags
   - aiff, riff: fix ID3 chunk padding
diff --git a/configure b/configure
index f1e85b1..083c090 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.13.
+# Generated by GNU Autoconf 2.69 for mpd 0.19.14.
 #
 # 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.13'
-PACKAGE_STRING='mpd 0.19.13'
+PACKAGE_VERSION='0.19.14'
+PACKAGE_STRING='mpd 0.19.14'
 PACKAGE_BUGREPORT='musicpd-dev-team at lists.sourceforge.net'
 PACKAGE_URL=''
 
@@ -1757,7 +1757,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.13 to adapt to many kinds of systems.
+\`configure' configures mpd 0.19.14 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1828,7 +1828,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of mpd 0.19.13:";;
+     short | recursive ) echo "Configuration of mpd 0.19.14:";;
    esac
   cat <<\_ACEOF
 
@@ -2169,7 +2169,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-mpd configure 0.19.13
+mpd configure 0.19.14
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2622,7 +2622,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.13, which was
+It was created by mpd $as_me 0.19.14, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -2973,7 +2973,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 VERSION_MAJOR=0
 VERSION_MINOR=19
-VERSION_REVISION=13
+VERSION_REVISION=14
 VERSION_EXTRA=0
 
 
@@ -3492,7 +3492,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='mpd'
- VERSION='0.19.13'
+ VERSION='0.19.14'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -20901,7 +20901,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.13, which was
+This file was extended by mpd $as_me 0.19.14, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -20967,7 +20967,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.13
+mpd config.status 0.19.14
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
diff --git a/configure.ac b/configure.ac
index 39f2aaf..66621e6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,10 +1,10 @@
 AC_PREREQ(2.60)
 
-AC_INIT(mpd, 0.19.13, musicpd-dev-team at lists.sourceforge.net)
+AC_INIT(mpd, 0.19.14, musicpd-dev-team at lists.sourceforge.net)
 
 VERSION_MAJOR=0
 VERSION_MINOR=19
-VERSION_REVISION=13
+VERSION_REVISION=14
 VERSION_EXTRA=0
 
 AC_CONFIG_SRCDIR([src/Main.cxx])
diff --git a/doc/doxygen.conf b/doc/doxygen.conf
index 0dbf465..701f806 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.13
+PROJECT_NUMBER = 0.19.14
 
 # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
 # base path where the generated documentation will be put.
diff --git a/src/archive/plugins/Iso9660ArchivePlugin.cxx b/src/archive/plugins/Iso9660ArchivePlugin.cxx
index ba415d3..6b5f47e 100644
--- a/src/archive/plugins/Iso9660ArchivePlugin.cxx
+++ b/src/archive/plugins/Iso9660ArchivePlugin.cxx
@@ -66,7 +66,11 @@ public:
 		return iso9660_iso_seek_read(iso, ptr, start, i_size);
 	}
 
-	void Visit(const char *path, ArchiveVisitor &visitor);
+	/**
+	 * @param capacity the path buffer size
+	 */
+	void Visit(char *path, size_t length, size_t capacity,
+		   ArchiveVisitor &visitor);
 
 	virtual void Close() override {
 		Unref();
@@ -84,32 +88,36 @@ static constexpr Domain iso9660_domain("iso9660");
 /* archive open && listing routine */
 
 inline void
-Iso9660ArchiveFile::Visit(const char *psz_path, ArchiveVisitor &visitor)
+Iso9660ArchiveFile::Visit(char *path, size_t length, size_t capacity,
+			  ArchiveVisitor &visitor)
 {
-	CdioList_t *entlist;
-	CdioListNode_t *entnode;
-	iso9660_stat_t *statbuf;
-	char pathname[4096];
-
-	entlist = iso9660_ifs_readdir (iso, psz_path);
+	auto *entlist = iso9660_ifs_readdir(iso, path);
 	if (!entlist) {
 		return;
 	}
 	/* Iterate over the list of nodes that iso9660_ifs_readdir gives  */
+	CdioListNode_t *entnode;
 	_CDIO_LIST_FOREACH (entnode, entlist) {
-		statbuf = (iso9660_stat_t *) _cdio_list_node_data (entnode);
+		auto *statbuf = (iso9660_stat_t *)
+			_cdio_list_node_data(entnode);
+		const char *filename = statbuf->filename;
+		if (strcmp(filename, ".") == 0 || strcmp(filename, "..") == 0)
+			continue;
+
+		size_t filename_length = strlen(filename);
+		if (length + filename_length + 1 >= capacity)
+			/* file name is too long */
+			continue;
 
-		strcpy(pathname, psz_path);
-		strcat(pathname, statbuf->filename);
+		memcpy(path + length, filename, filename_length + 1);
+		size_t new_length = length + filename_length;
 
 		if (iso9660_stat_s::_STAT_DIR == statbuf->type ) {
-			if (strcmp(statbuf->filename, ".") && strcmp(statbuf->filename, "..")) {
-				strcat(pathname, "/");
-				Visit(pathname, visitor);
-			}
+			memcpy(path + new_length, "/", 2);
+			Visit(path, new_length + 1, capacity, visitor);
 		} else {
 			//remove leading /
-			visitor.VisitArchiveEntry(pathname + 1);
+			visitor.VisitArchiveEntry(path + 1);
 		}
 	}
 	_cdio_list_free (entlist, true);
@@ -133,7 +141,8 @@ iso9660_archive_open(Path pathname, Error &error)
 void
 Iso9660ArchiveFile::Visit(ArchiveVisitor &visitor)
 {
-	Visit("/", visitor);
+	char path[4096] = "/";
+	Visit(path, 1, sizeof(path), visitor);
 }
 
 /* single archive handling */
diff --git a/src/decoder/plugins/DsdiffDecoderPlugin.cxx b/src/decoder/plugins/DsdiffDecoderPlugin.cxx
index b6c79e1..9953097 100644
--- a/src/decoder/plugins/DsdiffDecoderPlugin.cxx
+++ b/src/decoder/plugins/DsdiffDecoderPlugin.cxx
@@ -205,7 +205,7 @@ dsdiff_handle_native_tag(InputStream &is,
 	if (length == 0 || length > 60)
 		return;
 
-	char string[length];
+	char string[length + 1];
 	char *label;
 	label = string;
 
diff --git a/src/decoder/plugins/OpusReader.hxx b/src/decoder/plugins/OpusReader.hxx
index c5b8e91..219f3f4 100644
--- a/src/decoder/plugins/OpusReader.hxx
+++ b/src/decoder/plugins/OpusReader.hxx
@@ -85,7 +85,7 @@ public:
 
 	char *ReadString() {
 		uint32_t length;
-		if (!ReadWord(length))
+		if (!ReadWord(length) || length >= 65536)
 			return nullptr;
 
 		const char *src = (const char *)Read(length);
diff --git a/src/mixer/plugins/PulseMixerPlugin.cxx b/src/mixer/plugins/PulseMixerPlugin.cxx
index c5f2072..e0f6407 100644
--- a/src/mixer/plugins/PulseMixerPlugin.cxx
+++ b/src/mixer/plugins/PulseMixerPlugin.cxx
@@ -218,7 +218,7 @@ PulseMixer::SetVolume(unsigned new_volume, Error &error)
 
 	struct pa_cvolume cvolume;
 	pa_cvolume_set(&cvolume, volume.channels,
-		       (pa_volume_t)new_volume * PA_VOLUME_NORM / 100 + 0.5);
+		       (new_volume * PA_VOLUME_NORM + 50) / 100);
 	bool success = pulse_output_set_volume(output, &cvolume, error);
 	if (success)
 		volume = cvolume;
diff --git a/src/protocol/ArgParser.cxx b/src/protocol/ArgParser.cxx
index e373827..bdc1b95 100644
--- a/src/protocol/ArgParser.cxx
+++ b/src/protocol/ArgParser.cxx
@@ -92,7 +92,7 @@ check_range(Client &client, unsigned *value_r1, unsigned *value_r2,
 		return false;
 	}
 
-	if (unsigned(value) > std::numeric_limits<unsigned>::max()) {
+	if (value > std::numeric_limits<int>::max()) {
 		command_error(client, ACK_ERROR_ARG,
 			      "Number too large: %s", s);
 		return false;
@@ -117,7 +117,7 @@ check_range(Client &client, unsigned *value_r1, unsigned *value_r2,
 			return false;
 		}
 
-		if (unsigned(value) > std::numeric_limits<unsigned>::max()) {
+		if (value > std::numeric_limits<int>::max()) {
 			command_error(client, ACK_ERROR_ARG,
 				      "Number too large: %s", s);
 			return false;
diff --git a/src/tag/TagPool.cxx b/src/tag/TagPool.cxx
index 29f6053..97015b4 100644
--- a/src/tag/TagPool.cxx
+++ b/src/tag/TagPool.cxx
@@ -23,19 +23,23 @@
 #include "util/Cast.hxx"
 #include "util/VarSize.hxx"
 
+#include <limits>
+
 #include <assert.h>
 #include <string.h>
 #include <stdlib.h>
 
 Mutex tag_pool_lock;
 
-static constexpr size_t NUM_SLOTS = 4096;
+static constexpr size_t NUM_SLOTS = 4093;
 
 struct TagPoolSlot {
 	TagPoolSlot *next;
 	unsigned char ref;
 	TagItem item;
 
+	static constexpr unsigned MAX_REF = std::numeric_limits<decltype(ref)>::max();
+
 	TagPoolSlot(TagPoolSlot *_next, TagType type,
 		    const char *value, size_t length)
 		:next(_next), ref(1) {
@@ -116,7 +120,7 @@ tag_pool_get_item(TagType type, const char *value, size_t length)
 		if (slot->item.type == type &&
 		    length == strlen(slot->item.value) &&
 		    memcmp(value, slot->item.value, length) == 0 &&
-		    slot->ref < 0xff) {
+		    slot->ref < TagPoolSlot::MAX_REF) {
 			assert(slot->ref > 0);
 			++slot->ref;
 			return &slot->item;
@@ -135,19 +139,15 @@ tag_pool_dup_item(TagItem *item)
 
 	assert(slot->ref > 0);
 
-	if (slot->ref < 0xff) {
+	if (slot->ref < TagPoolSlot::MAX_REF) {
 		++slot->ref;
 		return item;
 	} else {
-		/* the reference counter overflows above 0xff;
-		   duplicate the item, and start with 1 */
+		/* the reference counter overflows above MAX_REF;
+		   obtain a reference to a different TagPoolSlot which
+		   isn't yet "full" */
 		size_t length = strlen(item->value);
-		auto slot_p = tag_value_slot_p(item->type,
-					       item->value, length);
-		slot = TagPoolSlot::Create(*slot_p, item->type,
-					   item->value, strlen(item->value));
-		*slot_p = slot;
-		return &slot->item;
+		return tag_pool_get_item(item->type, item->value, length);
 	}
 }
 
diff --git a/src/thread/PosixCond.hxx b/src/thread/PosixCond.hxx
index b3fe204..1d4a789 100644
--- a/src/thread/PosixCond.hxx
+++ b/src/thread/PosixCond.hxx
@@ -41,9 +41,13 @@ class PosixCond {
 	pthread_cond_t cond;
 
 public:
-#if defined(__NetBSD__) || defined(__BIONIC__)
-	/* NetBSD's PTHREAD_COND_INITIALIZER is not compatible with
-	   "constexpr" */
+#ifdef __GLIBC__
+	/* optimized constexpr constructor for pthread implementations
+	   that support it */
+	constexpr PosixCond():cond(PTHREAD_COND_INITIALIZER) {}
+#else
+	/* slow fallback for pthread implementations that are not
+	   compatible with "constexpr" */
 	PosixCond() {
 		pthread_cond_init(&cond, nullptr);
 	}
@@ -51,10 +55,6 @@ public:
 	~PosixCond() {
 		pthread_cond_destroy(&cond);
 	}
-#else
-	/* optimized constexpr constructor for sane POSIX
-	   implementations */
-	constexpr PosixCond():cond(PTHREAD_COND_INITIALIZER) {}
 #endif
 
 	PosixCond(const PosixCond &other) = delete;
diff --git a/src/thread/PosixMutex.hxx b/src/thread/PosixMutex.hxx
index 5805158..6afe850 100644
--- a/src/thread/PosixMutex.hxx
+++ b/src/thread/PosixMutex.hxx
@@ -41,9 +41,13 @@ class PosixMutex {
 	pthread_mutex_t mutex;
 
 public:
-#if defined(__NetBSD__) || defined(__BIONIC__)
-	/* NetBSD's PTHREAD_MUTEX_INITIALIZER is not compatible with
-	   "constexpr" */
+#ifdef __GLIBC__
+	/* optimized constexpr constructor for pthread implementations
+	   that support it */
+	constexpr PosixMutex():mutex(PTHREAD_MUTEX_INITIALIZER) {}
+#else
+	/* slow fallback for pthread implementations that are not
+	   compatible with "constexpr" */
 	PosixMutex() {
 		pthread_mutex_init(&mutex, nullptr);
 	}
@@ -51,10 +55,6 @@ public:
 	~PosixMutex() {
 		pthread_mutex_destroy(&mutex);
 	}
-#else
-	/* optimized constexpr constructor for sane POSIX
-	   implementations */
-	constexpr PosixMutex():mutex(PTHREAD_MUTEX_INITIALIZER) {}
 #endif
 
 	PosixMutex(const PosixMutex &other) = delete;
diff --git a/src/util/HugeAllocator.cxx b/src/util/HugeAllocator.cxx
index 1da049f..f26ffc8 100644
--- a/src/util/HugeAllocator.cxx
+++ b/src/util/HugeAllocator.cxx
@@ -46,7 +46,7 @@ static size_t
 AlignToPageSize(size_t size)
 {
 	static const long page_size = sysconf(_SC_PAGESIZE);
-	if (page_size > 0)
+	if (page_size == 0)
 		return size;
 
 	size_t ps(page_size);

-- 
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