pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/audio/sox PR pkg/56800 hitting v or V during sox's pla...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/20397a86f438
branches:  trunk
changeset: 377653:20397a86f438
user:      nia <nia%pkgsrc.org@localhost>
date:      Sun Apr 24 09:39:46 2022 +0000

description:
PR pkg/56800 hitting v or V during sox's play command causes a segfault

from Onno van der Linden

diffstat:

 audio/sox/Makefile                     |   4 ++--
 audio/sox/distinfo                     |   6 +++---
 audio/sox/patches/patch-aa             |  14 --------------
 audio/sox/patches/patch-src_sox.c      |  34 ++++++++++++++++++++++++++++++++++
 audio/sox/patches/patch-src_sunaudio.c |  31 +++++++++++++++++++++++++++----
 5 files changed, 66 insertions(+), 23 deletions(-)

diffs (126 lines):

diff -r cbe3521091e9 -r 20397a86f438 audio/sox/Makefile
--- a/audio/sox/Makefile        Sun Apr 24 08:36:07 2022 +0000
+++ b/audio/sox/Makefile        Sun Apr 24 09:39:46 2022 +0000
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.69 2022/03/28 10:43:39 tnn Exp $
+# $NetBSD: Makefile,v 1.70 2022/04/24 09:39:46 nia Exp $
 
 DISTNAME=      sox-14.4.2
-PKGREVISION=   4
+PKGREVISION=   5
 CATEGORIES=    audio
 MASTER_SITES=  ${MASTER_SITE_SOURCEFORGE:=sox/}
 
diff -r cbe3521091e9 -r 20397a86f438 audio/sox/distinfo
--- a/audio/sox/distinfo        Sun Apr 24 08:36:07 2022 +0000
+++ b/audio/sox/distinfo        Sun Apr 24 09:39:46 2022 +0000
@@ -1,10 +1,10 @@
-$NetBSD: distinfo,v 1.30 2021/10/26 09:59:30 nia Exp $
+$NetBSD: distinfo,v 1.31 2022/04/24 09:39:46 nia Exp $
 
 BLAKE2s (sox-14.4.2.tar.gz) = a995d9682dad17ae557248bc008e16309537b49e3229390478e432882445b6d2
 SHA512 (sox-14.4.2.tar.gz) = b5c6203f4f5577503a034fe5b3d6a033ee97fe4d171c533933e2b036118a43a14f97c9668433229708609ccf9ee16abdeca3fc7501aa0aafe06baacbba537eca
 Size (sox-14.4.2.tar.gz) = 1134299 bytes
-SHA1 (patch-aa) = e6f3d06450862795648622a017b2c696328872f5
 SHA1 (patch-ak) = 28675f56a0e2969d0facd98282667c53eb10c0ed
 SHA1 (patch-src_coreaudio.c) = baee5596ec5efdc12f99ea9dab9e9c691a17b08d
 SHA1 (patch-src_oss.c) = dca4dcf55d4bfa1da80b789cbddb48a9302e694b
-SHA1 (patch-src_sunaudio.c) = 286ad890a32d69d499f76faa255473889b091d56
+SHA1 (patch-src_sox.c) = 2ac1ec7157a1cd9581d07fea5093f49df2dd7b7f
+SHA1 (patch-src_sunaudio.c) = 9f6a67b09c46cbc8298c226d972c43e86aeaae26
diff -r cbe3521091e9 -r 20397a86f438 audio/sox/patches/patch-aa
--- a/audio/sox/patches/patch-aa        Sun Apr 24 08:36:07 2022 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,14 +0,0 @@
-$NetBSD: patch-aa,v 1.13 2010/07/23 07:55:12 adam Exp $
-
---- src/sox.c.orig     2010-07-22 15:31:02.000000000 +0000
-+++ src/sox.c
-@@ -1216,7 +1216,9 @@ static void adjust_volume(int delta)
-       vol2 = range_limit(vol1 + delta, 0, 100);
-       AUDIO_INITINFO(&audio_info);
-       audio_info.play.gain = (vol2 * AUDIO_MAX_GAIN + 50) / 100;
-+#if !defined(__NetBSD__)
-       audio_info.output_muted = 0;
-+#endif
-       lsx_debug("%04x %04x", vol1, vol2);
-       if (vol1 != vol2 && ioctl(fd, AUDIO_SETINFO, &audio_info) < 0)
-         vol2 = vol1;
diff -r cbe3521091e9 -r 20397a86f438 audio/sox/patches/patch-src_sox.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/audio/sox/patches/patch-src_sox.c Sun Apr 24 09:39:46 2022 +0000
@@ -0,0 +1,34 @@
+$NetBSD: patch-src_sox.c,v 1.1 2022/04/24 09:39:46 nia Exp $
+
+PR pkg/56800 hitting v or V during sox's play command causes a
+segfault
+
+https://sourceforge.net/p/sox/code/ci/4b17639fb7591153dbd3e234eea21b1a2a29fcfa/
+from more than 10 years ago changed the sun audio driver for the 14.4 release
+to not use stdio (among others) while adjust_volume() in sox.c still used
+fileno under the assumption that stdio was being used in the audio driver.
+
+output_muted is not defined on NetBSD.
+
+--- src/sox.c.orig     2014-10-06 02:02:30.000000000 +0000
++++ src/sox.c
+@@ -1313,7 +1313,8 @@ static void adjust_volume(int delta)
+ #elif defined(HAVE_AUDIOIO_H)
+ static void adjust_volume(int delta)
+ {
+-  int vol1 = 0, vol2 = 0, fd = fileno((FILE*)ofile->ft->fp);
++  int vol1 = 0, vol2 = 0, fd;
++  fd = ofile->ft->fp != NULL ? *((int *)ofile->ft->fp) : -1;
+   if (fd >= 0) {
+     audio_info_t audio_info;
+     if (ioctl(fd, AUDIO_GETINFO, &audio_info) >= 0) {
+@@ -1321,7 +1322,9 @@ static void adjust_volume(int delta)
+       vol2 = range_limit(vol1 + delta, 0, 100);
+       AUDIO_INITINFO(&audio_info);
+       audio_info.play.gain = (vol2 * AUDIO_MAX_GAIN + 50) / 100;
++#if defined(__sun)
+       audio_info.output_muted = 0;
++#endif
+       lsx_debug("%04x %04x", vol1, vol2);
+       if (vol1 != vol2 && ioctl(fd, AUDIO_SETINFO, &audio_info) < 0)
+         vol2 = vol1;
diff -r cbe3521091e9 -r 20397a86f438 audio/sox/patches/patch-src_sunaudio.c
--- a/audio/sox/patches/patch-src_sunaudio.c    Sun Apr 24 08:36:07 2022 +0000
+++ b/audio/sox/patches/patch-src_sunaudio.c    Sun Apr 24 09:39:46 2022 +0000
@@ -1,9 +1,32 @@
-$NetBSD: patch-src_sunaudio.c,v 1.1 2015/05/25 19:06:24 bsiegert Exp $
+$NetBSD: patch-src_sunaudio.c,v 1.2 2022/04/24 09:39:46 nia Exp $
+
+- Make the now unused (in the audio driver's case) void *fp member of the
+  sox_format_t structure a pointer to the filedescriptor of the audio
+  device in the driver and reference it in adjust_volume() with an
+  additional check for NULL. (PR pkg/56800)
+
+- Fix segfault when playing (PR pkg/49929).
 
-Fix segfault when playing (PR pkg/49929).
---- src/sunaudio.c.orig        2015-05-25 19:00:39.000000000 +0000
+--- src/sunaudio.c.orig        2014-10-06 01:59:34.000000000 +0000
 +++ src/sunaudio.c
-@@ -443,7 +443,7 @@ static size_t sunwrite(
+@@ -336,6 +336,8 @@ static int sunstartwrite(sox_format_t * 
+     pPriv->cOutput = sox_globals.bufsiz >> pPriv->sample_shift;
+     pPriv->pOutput = lsx_malloc((size_t)pPriv->cOutput << pPriv->sample_shift);
+ 
++    ft->fp = &pPriv->device;
++
+     return (SOX_SUCCESS);
+ }
+ 
+@@ -348,6 +350,7 @@ static int sunstop(sox_format_t* ft)
+     if (pPriv->pOutput) {
+         free(pPriv->pOutput);
+     }
++    ft->fp = NULL;
+     return SOX_SUCCESS;
+ }
+ 
+@@ -443,7 +446,7 @@ static size_t sunwrite(
          size_t cbStride;
          int cbWritten;
  



Home | Main Index | Thread Index | Old Index