Commit 2f341c1f authored by Taner Tas's avatar Taner Tas Committed by Leonardo Arena

main/alsa-lib: Upgrade to 1.1.5

Four patches seem already applied to 1.1.5.
These files can be removed from tree:
* alsa-lib-poll.patch
* alsa-lib-stdint.patch
* ucm_add_limits_h.patch
* 0001-snd_user_file-avoid-use-wordexp.patch
parent d0034b24
From 1f9113336e8eb4bd89ca040e90c5fdc79b0c567f Mon Sep 17 00:00:00 2001
From: Natanael Copa <ncopa@alpinelinux.org>
Date: Tue, 11 Jul 2017 18:25:13 +0200
Subject: [PATCH] snd_user_file: avoid use wordexp
As suggested in POSIX[1], wordexp might execute the shell. If the libc
implementation does so, it will break the firefox sandbox which does
not allow exec. This happened on Alpine Linux with musl libc[2].
Since we cannot guarantee that the system wordexp implementation does
not execute shell, we cannot really use it, and need to implement the
~/ expansion ourselves.
[1]: http://pubs.opengroup.org/onlinepubs/9699919799/functions/wordexp.html#tag_16_684_08
[2]: http://bugs.alpinelinux.org/issues/7454#note-2
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
---
src/userfile.c | 77 +++++++++++++++++++++++++++++++++++-----------------------
1 file changed, 47 insertions(+), 30 deletions(-)
diff --git a/src/userfile.c b/src/userfile.c
index 72779da4..0e3f5fae 100644
--- a/src/userfile.c
+++ b/src/userfile.c
@@ -21,6 +21,11 @@
#include <config.h>
#include <string.h>
#include <errno.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <pwd.h>
+#include <stdio.h>
+#include <stdlib.h>
/**
* \brief Get the full file name
@@ -28,46 +33,58 @@
* \param result The pointer to store the resultant file name
* \return 0 if successful, or a negative error code
*
- * Parses the given file name with POSIX-Shell-like expansion and
- * stores the first matchine one. The returned string is strdup'ed.
+ * Parses the given file name with POSIX-Shell-like expansion for ~/.
+ * The returned string is strdup'ed.
*/
-#ifdef HAVE_WORDEXP_H
-#include <wordexp.h>
#include <assert.h>
int snd_user_file(const char *file, char **result)
{
- wordexp_t we;
int err;
-
+ size_t len;
+ char *buf = NULL;
+
assert(file && result);
- err = wordexp(file, &we, WRDE_NOCMD);
- switch (err) {
- case WRDE_NOSPACE:
- wordfree(&we);
- return -ENOMEM;
- case 0:
- if (we.we_wordc == 1)
- break;
- wordfree(&we);
- /* fall thru */
- default:
- return -EINVAL;
+ *result = NULL;
+
+ /* expand ~/ if needed */
+ if (file[0] == '~' && file[1] == '/') {
+ const char *home = getenv("HOME");
+ if (home == NULL) {
+ struct passwd pwent, *p = NULL;
+ uid_t id = getuid();
+ size_t bufsize = 1024;
+
+ buf = malloc(bufsize);
+ if (buf == NULL)
+ goto out;
+
+ while ((err = getpwuid_r(id, &pwent, buf, bufsize, &p)) == ERANGE) {
+ char *newbuf;
+ bufsize += 1024;
+ if (bufsize < 1024)
+ break;
+ newbuf = realloc(buf, bufsize);
+ if (newbuf == NULL)
+ goto out;
+ buf = newbuf;
+ }
+ home = err ? "" : pwent.pw_dir;
+ }
+ len = strlen(home) + strlen(&file[2]) + 2;
+ *result = malloc(len);
+ if (*result)
+ snprintf(*result, len, "%s/%s", home, &file[2]);
+ } else {
+ *result = strdup(file);
}
- *result = strdup(we.we_wordv[0]);
- wordfree(&we);
+
+out:
+ if (buf)
+ free(buf);
+
if (*result == NULL)
return -ENOMEM;
return 0;
}
-#else /* !HAVE_WORDEXP_H */
-/* just copy the string - would be nicer to expand by ourselves, though... */
-int snd_user_file(const char *file, char **result)
-{
- *result = strdup(file);
- if (! *result)
- return -ENOMEM;
- return 0;
-}
-#endif /* HAVE_WORDEXP_H */
--
2.13.2
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=alsa-lib
pkgver=1.1.4.1
pkgrel=3
pkgver=1.1.5
pkgrel=0
pkgdesc="An alternative implementation of Linux sound support"
url="http://www.alsa-project.org"
arch="all"
......@@ -9,10 +9,6 @@ license="LGPL-2.0-or-later"
subpackages="$pkgname-dev $pkgname-dbg"
makedepends="linux-headers"
source="ftp://ftp.alsa-project.org/pub/lib/$pkgname-$pkgver.tar.bz2
alsa-lib-poll.patch
alsa-lib-stdint.patch
ucm_add_limits_h.patch
0001-snd_user_file-avoid-use-wordexp.patch
remove-test.patch
"
......@@ -51,9 +47,5 @@ package() {
make -j1 DESTDIR="$pkgdir" install
}
sha512sums="7b548c4ee29c4a1230a0edcd5d19219831290f96a214180a6530628acc05278d1348376195287d188f4f44d6be1914391c63994f1b50985c3eee74352da26b0b alsa-lib-1.1.4.1.tar.bz2
bdf86a1b76b2e6e9b43af33989fe51e4900fa0c6f317d8d746f30c540df647dbe0f6d41ec35b36b1cf7e46cc5e910e0a62bc39c765f849356ecd6e98d1de5885 alsa-lib-poll.patch
2351262dade9a3c1a3de1b7d1a3a53a634a438b9b8aae7cc69e2b981500051f039e6381359b81392114ec6236e3d513b577bd4bf12c3d2ce1f871cd7651b2cab alsa-lib-stdint.patch
3b37652d50809443b5f8e80f8d447108195b0cd66fd917805bb393fc091584b6f3dad4414f568742b61745617e7a695862058a0a0f93dcc31e4c97177a520352 ucm_add_limits_h.patch
e6baeee549533ea4b113bacfa772c183456ce51e6c84b378b82a6735159e43a11ff30c0a4a15207110c42dbd7be5e67bc5e2f593cdc99bd8b079204df7498ceb 0001-snd_user_file-avoid-use-wordexp.patch
sha512sums="c79ceaa1ebfeda2caf41a0495ea31dd2748a11795989aebc341ae13a5c96d21495e4542571d5590e68b2575ceddd6e84059a950ddb78e6c0b9d94861faee4f58 alsa-lib-1.1.5.tar.bz2
8ef518517647b702da7f3573f4f3f10be8bbac3f092834b38c59521f7236acae258a9afe65eebfa415828135ac8a1836e3dce83ee3f0eaf4403158a48802144d remove-test.patch"
diff --git a/aserver/aserver.c b/aserver/aserver.c
index ac20706..46f731a 100644
--- a/aserver/aserver.c
+++ b/aserver/aserver.c
@@ -20,7 +20,7 @@
#include <sys/shm.h>
#include <sys/socket.h>
-#include <sys/poll.h>
+#include <poll.h>
#include <sys/un.h>
#include <sys/uio.h>
#include <stdio.h>
diff --git a/include/asoundlib-head.h b/include/asoundlib-head.h
index 1ec611e..21e32c6 100644
--- a/include/asoundlib-head.h
+++ b/include/asoundlib-head.h
@@ -35,6 +35,6 @@
#include <string.h>
#include <fcntl.h>
#include <assert.h>
-#include <sys/poll.h>
+#include <poll.h>
#include <errno.h>
#include <stdarg.h>
diff --git a/include/asoundlib.h b/include/asoundlib.h
index 3c2766e..a546194 100644
--- a/include/asoundlib.h
+++ b/include/asoundlib.h
@@ -35,7 +35,7 @@
#include <string.h>
#include <fcntl.h>
#include <assert.h>
-#include <sys/poll.h>
+#include <poll.h>
#include <errno.h>
#include <stdarg.h>
#include <endian.h>
diff --git a/include/local.h b/include/local.h
index 317f2e3..6a43a47 100644
--- a/include/local.h
+++ b/include/local.h
@@ -47,7 +47,7 @@
#error Header defining endianness not defined
#endif
#include <stdarg.h>
-#include <sys/poll.h>
+#include <poll.h>
#include <sys/types.h>
#include <errno.h>
#if defined(__linux__)
diff --git a/src/control/control.c b/src/control/control.c
index 6c00b8e..fd0c303 100644
--- a/src/control/control.c
+++ b/src/control/control.c
@@ -90,7 +90,7 @@ I/O operations.
#include <string.h>
#include <fcntl.h>
#include <signal.h>
-#include <sys/poll.h>
+#include <poll.h>
#include <stdbool.h>
#include "control_local.h"
diff --git a/src/control/control_shm.c b/src/control/control_shm.c
index bd07d4a..9a2e268 100644
--- a/src/control/control_shm.c
+++ b/src/control/control_shm.c
@@ -27,7 +27,7 @@
#include <fcntl.h>
#include <sys/shm.h>
#include <sys/socket.h>
-#include <sys/poll.h>
+#include <poll.h>
#include <sys/un.h>
#include <sys/uio.h>
#include <sys/mman.h>
diff --git a/src/pcm/pcm.c b/src/pcm/pcm.c
index f832399..e9d502a 100644
--- a/src/pcm/pcm.c
+++ b/src/pcm/pcm.c
@@ -650,7 +650,7 @@ playback devices.
#include <stdarg.h>
#include <signal.h>
#include <ctype.h>
-#include <sys/poll.h>
+#include <poll.h>
#include <sys/mman.h>
#include <limits.h>
#include "pcm_local.h"
diff --git a/src/pcm/pcm_direct.c b/src/pcm/pcm_direct.c
index c3925cc..18f1dd5 100644
--- a/src/pcm/pcm_direct.c
+++ b/src/pcm/pcm_direct.c
@@ -30,7 +30,7 @@
#include <grp.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
-#include <sys/poll.h>
+#include <poll.h>
#include <sys/shm.h>
#include <sys/sem.h>
#include <sys/wait.h>
diff --git a/src/pcm/pcm_mmap.c b/src/pcm/pcm_mmap.c
index 1948289..4cf220a 100644
--- a/src/pcm/pcm_mmap.c
+++ b/src/pcm/pcm_mmap.c
@@ -22,7 +22,7 @@
#include <stdio.h>
#include <malloc.h>
#include <string.h>
-#include <sys/poll.h>
+#include <poll.h>
#include <sys/mman.h>
#ifdef HAVE_SYS_SHM_H
#include <sys/shm.h>
diff --git a/src/pcm/pcm_share.c b/src/pcm/pcm_share.c
index 5d8aaf2..21a57fc 100644
--- a/src/pcm/pcm_share.c
+++ b/src/pcm/pcm_share.c
@@ -34,7 +34,7 @@
#include <signal.h>
#include <math.h>
#include <sys/socket.h>
-#include <sys/poll.h>
+#include <poll.h>
#include <pthread.h>
#include "pcm_local.h"
diff --git a/src/pcm/pcm_shm.c b/src/pcm/pcm_shm.c
index a815ac6..4ee958c 100644
--- a/src/pcm/pcm_shm.c
+++ b/src/pcm/pcm_shm.c
@@ -36,7 +36,7 @@
#include <sys/ioctl.h>
#include <sys/shm.h>
#include <sys/socket.h>
-#include <sys/poll.h>
+#include <poll.h>
#include <sys/un.h>
#include <sys/mman.h>
#include <netinet/in.h>
diff --git a/src/seq/seq.c b/src/seq/seq.c
index 9279830..d2027cb 100644
--- a/src/seq/seq.c
+++ b/src/seq/seq.c
@@ -777,7 +777,7 @@ void event_filter(snd_seq_t *seq, snd_seq_event_t *ev)
*/
-#include <sys/poll.h>
+#include <poll.h>
#include "seq_local.h"
/****************************************************************************
diff --git a/src/shmarea.c b/src/shmarea.c
index 9843aa8..eaa71f0 100644
--- a/src/shmarea.c
+++ b/src/shmarea.c
@@ -27,7 +27,7 @@
#include <malloc.h>
#include <string.h>
#include <errno.h>
-#include <sys/poll.h>
+#include <poll.h>
#include <sys/mman.h>
#include <sys/shm.h>
#include "list.h"
diff -ru alsa-lib-1.1.0.orig/include/pcm.h alsa-lib-1.1.0/include/pcm.h
--- alsa-lib-1.1.0.orig/include/pcm.h 2015-11-09 09:39:18.000000000 +0200
+++ alsa-lib-1.1.0/include/pcm.h 2016-02-11 14:28:23.731309152 +0200
@@ -33,6 +33,7 @@
extern "C" {
#endif
+#include <stdint.h>
/**
* \defgroup PCM PCM Interface
* See the \ref pcm page for more details.
@@ -1108,10 +1109,10 @@
int snd_pcm_format_physical_width(snd_pcm_format_t format); /* in bits */
snd_pcm_format_t snd_pcm_build_linear_format(int width, int pwidth, int unsignd, int big_endian);
ssize_t snd_pcm_format_size(snd_pcm_format_t format, size_t samples);
-u_int8_t snd_pcm_format_silence(snd_pcm_format_t format);
-u_int16_t snd_pcm_format_silence_16(snd_pcm_format_t format);
-u_int32_t snd_pcm_format_silence_32(snd_pcm_format_t format);
-u_int64_t snd_pcm_format_silence_64(snd_pcm_format_t format);
+uint8_t snd_pcm_format_silence(snd_pcm_format_t format);
+uint16_t snd_pcm_format_silence_16(snd_pcm_format_t format);
+uint32_t snd_pcm_format_silence_32(snd_pcm_format_t format);
+uint64_t snd_pcm_format_silence_64(snd_pcm_format_t format);
int snd_pcm_format_set_silence(snd_pcm_format_t format, void *buf, unsigned int samples);
snd_pcm_sframes_t snd_pcm_bytes_to_frames(snd_pcm_t *pcm, ssize_t bytes);
Only in alsa-lib-1.1.0/include: pcm.h.orig
diff -ru alsa-lib-1.1.0.orig/src/pcm/pcm_misc.c alsa-lib-1.1.0/src/pcm/pcm_misc.c
--- alsa-lib-1.1.0.orig/src/pcm/pcm_misc.c 2015-11-09 09:39:18.000000000 +0200
+++ alsa-lib-1.1.0/src/pcm/pcm_misc.c 2016-02-11 14:28:27.741355826 +0200
@@ -387,7 +387,7 @@
* \param format Sample format
* \return silence 64 bit word
*/
-u_int64_t snd_pcm_format_silence_64(snd_pcm_format_t format)
+uint64_t snd_pcm_format_silence_64(snd_pcm_format_t format)
{
switch (format) {
case SNDRV_PCM_FORMAT_S8:
@@ -467,7 +467,7 @@
{
union {
float f[2];
- u_int64_t i;
+ uint64_t i;
} u;
u.f[0] = u.f[1] = 0.0;
#ifdef SNDRV_LITTLE_ENDIAN
@@ -480,7 +480,7 @@
{
union {
double f;
- u_int64_t i;
+ uint64_t i;
} u;
u.f = 0.0;
#ifdef SNDRV_LITTLE_ENDIAN
@@ -493,7 +493,7 @@
{
union {
float f[2];
- u_int64_t i;
+ uint64_t i;
} u;
u.f[0] = u.f[1] = 0.0;
#ifdef SNDRV_LITTLE_ENDIAN
@@ -506,7 +506,7 @@
{
union {
double f;
- u_int64_t i;
+ uint64_t i;
} u;
u.f = 0.0;
#ifdef SNDRV_LITTLE_ENDIAN
@@ -539,10 +539,10 @@
* \param format Sample format
* \return silence 32 bit word
*/
-u_int32_t snd_pcm_format_silence_32(snd_pcm_format_t format)
+uint32_t snd_pcm_format_silence_32(snd_pcm_format_t format)
{
assert(snd_pcm_format_physical_width(format) <= 32);
- return (u_int32_t)snd_pcm_format_silence_64(format);
+ return (uint32_t)snd_pcm_format_silence_64(format);
}
/**
@@ -550,10 +550,10 @@
* \param format Sample format
* \return silence 16 bit word
*/
-u_int16_t snd_pcm_format_silence_16(snd_pcm_format_t format)
+uint16_t snd_pcm_format_silence_16(snd_pcm_format_t format)
{
assert(snd_pcm_format_physical_width(format) <= 16);
- return (u_int16_t)snd_pcm_format_silence_64(format);
+ return (uint16_t)snd_pcm_format_silence_64(format);
}
/**
@@ -561,10 +561,10 @@
* \param format Sample format
* \return silence 8 bit word
*/
-u_int8_t snd_pcm_format_silence(snd_pcm_format_t format)
+uint8_t snd_pcm_format_silence(snd_pcm_format_t format)
{
assert(snd_pcm_format_physical_width(format) <= 8);
- return (u_int8_t)snd_pcm_format_silence_64(format);
+ return (uint8_t)snd_pcm_format_silence_64(format);
}
/**
@@ -580,7 +580,7 @@
return 0;
switch (snd_pcm_format_physical_width(format)) {
case 4: {
- u_int8_t silence = snd_pcm_format_silence_64(format);
+ uint8_t silence = snd_pcm_format_silence_64(format);
unsigned int samples1;
if (samples % 2 != 0)
return -EINVAL;
@@ -589,13 +589,13 @@
break;
}
case 8: {
- u_int8_t silence = snd_pcm_format_silence_64(format);
+ uint8_t silence = snd_pcm_format_silence_64(format);
memset(data, silence, samples);
break;
}
case 16: {
- u_int16_t silence = snd_pcm_format_silence_64(format);
- u_int16_t *pdata = (u_int16_t *)data;
+ uint16_t silence = snd_pcm_format_silence_64(format);
+ uint16_t *pdata = (uint16_t *)data;
if (! silence)
memset(data, 0, samples * 2);
else {
@@ -605,8 +605,8 @@
break;
}
case 24: {
- u_int32_t silence = snd_pcm_format_silence_64(format);
- u_int8_t *pdata = (u_int8_t *)data;
+ uint32_t silence = snd_pcm_format_silence_64(format);
+ uint8_t *pdata = (uint8_t *)data;
if (! silence)
memset(data, 0, samples * 3);
else {
@@ -625,8 +625,8 @@
break;
}
case 32: {
- u_int32_t silence = snd_pcm_format_silence_64(format);
- u_int32_t *pdata = (u_int32_t *)data;
+ uint32_t silence = snd_pcm_format_silence_64(format);
+ uint32_t *pdata = (uint32_t *)data;
if (! silence)
memset(data, 0, samples * 4);
else {
@@ -636,8 +636,8 @@
break;
}
case 64: {
- u_int64_t silence = snd_pcm_format_silence_64(format);
- u_int64_t *pdata = (u_int64_t *)data;
+ uint64_t silence = snd_pcm_format_silence_64(format);
+ uint64_t *pdata = (uint64_t *)data;
if (! silence)
memset(data, 0, samples * 8);
else {
Only in alsa-lib-1.1.0/src/pcm: pcm_misc.c.orig
--- a/src/ucm/parser.c
+++ b/src/ucm/parser.c
@@ -31,6 +31,7 @@
*/
#include "ucm_local.h"
+#include <limits.h>
#include <dirent.h>
/** The name of the environment variable containing the UCM directory */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment