Here is an update to libsndfile 1.0.31.
Index: Makefile
===================================================================
RCS file: /home/cvs/ports/audio/libsndfile/Makefile,v
retrieving revision 1.35
diff -u -p -u -p -r1.35 Makefile
--- Makefile 13 Feb 2021 06:31:07 -0000 1.35
+++ Makefile 20 Feb 2021 01:16:02 -0000
@@ -2,12 +2,12 @@
COMMENT= library to handle various audio file formats
-DISTNAME= libsndfile-1.0.30
-REVISION= 0
+VER= 1.0.31
+DISTNAME= libsndfile-${VER}
CATEGORIES= audio
GH_ACCOUNT= libsndfile
GH_PROJECT= libsndfile
-GH_TAGNAME= v1.0.30
+GH_TAGNAME= ${VER}
HOMEPAGE= https://github.com/libsndfile/libsndfile/
Index: distinfo
===================================================================
RCS file: /home/cvs/ports/audio/libsndfile/distinfo,v
retrieving revision 1.18
diff -u -p -u -p -r1.18 distinfo
--- distinfo 16 Jan 2021 12:53:12 -0000 1.18
+++ distinfo 20 Feb 2021 01:13:09 -0000
@@ -1,2 +1,2 @@
-SHA256 (libsndfile-1.0.30.tar.gz) =
WUK5Y9HbPtirH/uFcIMiqpY333bZ/oTh3+Sal6kOj0c=
-SIZE (libsndfile-1.0.30.tar.gz) = 650659
+SHA256 (libsndfile-1.0.31.tar.gz) =
jN7grLBrsKPBpspSRXVkPfix86VaCJO03Z+CnQgmN4U=
+SIZE (libsndfile-1.0.31.tar.gz) = 662584
Index: patches/patch-CMakeLists_txt
===================================================================
RCS file: patches/patch-CMakeLists_txt
diff -N patches/patch-CMakeLists_txt
--- patches/patch-CMakeLists_txt 16 Jan 2021 12:54:12 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,16 +0,0 @@
-$OpenBSD: patch-CMakeLists_txt,v 1.1 2021/01/16 12:54:12 sthen Exp $
-
-CMake: Fix INSTALL_MANPAGES option.
-
-Index: CMakeLists.txt
---- CMakeLists.txt.orig
-+++ CMakeLists.txt
-@@ -74,7 +74,7 @@ if (NOT ENABLE_CPU_CLIP)
- set (CPU_CLIPS_NEGATIVE FALSE)
- endif ()
- cmake_dependent_option (ENABLE_COMPATIBLE_LIBSNDFILE_NAME "Set DLL name to libsndfile-1.dll
(canonical name), sndfile.dll otherwise" OFF "WIN32;BUILD_SHARED_LIBS" OFF)
--cmake_dependent_option (INSTALL_MANPAGES "Install man pages for programs" ON
"BUILD_PROGRAMS AND (UNIX OR MINGW OR CYGWIN)" OFF)
-+cmake_dependent_option (INSTALL_MANPAGES "Install man pages for programs" ON
"BUILD_PROGRAMS" OFF)
-
- set (HAVE_EXTERNAL_XIPH_LIBS ${ENABLE_EXTERNAL_LIBS})
- set (HAVE_SQLITE3 ${BUILD_REGTEST})
Index: patches/patch-src_aiff_c
===================================================================
RCS file: patches/patch-src_aiff_c
diff -N patches/patch-src_aiff_c
--- patches/patch-src_aiff_c 16 Jan 2021 12:54:12 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,63 +0,0 @@
-$OpenBSD: patch-src_aiff_c,v 1.2 2021/01/16 12:54:12 sthen Exp $
-
-- Fix aiff_read_header() memory leak.
-- Fix memory leak in aiff_open.
-- Fix AIFF parsing bug.
-- Fix memory leak in aiff_read_basc_chunk.
-- Fix memory leak in aiff_read_header.
-
-Index: src/aiff.c
---- src/aiff.c.orig
-+++ src/aiff.c
-@@ -243,6 +243,8 @@ aiff_open (SF_PRIVATE *psf)
- if ((psf->container_data = calloc (1, sizeof (AIFF_PRIVATE))) == NULL)
- return SFE_MALLOC_FAILED ;
-
-+ psf->container_close = aiff_close ;
-+
- if (psf->file.mode == SFM_READ || (psf->file.mode == SFM_RDWR &&
psf->filelength > 0))
- { if ((error = aiff_read_header (psf, &comm_fmt)))
- return error ;
-@@ -283,7 +285,6 @@ aiff_open (SF_PRIVATE *psf)
- psf->set_chunk = aiff_set_chunk ;
- } ;
-
-- psf->container_close = aiff_close ;
- psf->command = aiff_command ;
-
- switch (SF_CODEC (psf->sf.format))
-@@ -498,6 +499,11 @@ aiff_read_header (SF_PRIVATE *psf, COMM_CHUNK *comm_fm
- return SFE_WAV_BAD_PEAK ;
- } ;
-
-+ if (psf->peak_info)
-+ { psf_log_printf (psf, "*** Found
existing peak info, using last one.\n") ;
-+ free (psf->peak_info) ;
-+ psf->peak_info = NULL ;
-+ } ;
- if ((psf->peak_info = peak_info_calloc
(psf->sf.channels)) == NULL)
- return SFE_MALLOC_FAILED ;
-
-@@ -800,6 +806,10 @@ aiff_read_header (SF_PRIVATE *psf, COMM_CHUNK *comm_fm
- break ;
- } ;
-
-+ if (psf->cues)
-+ { free (psf->cues) ;
-+ psf->cues = NULL ;
-+ } ;
- if ((psf->cues = psf_cues_alloc
(mark_count)) == NULL)
- return
SFE_MALLOC_FAILED ;
-
-@@ -1719,6 +1729,11 @@ aiff_read_basc_chunk (SF_PRIVATE * psf, int datasize)
-
- psf_log_printf (psf, " Loop Type : 0x%x (%s)\n", bc.loopType,
type_str) ;
-
-+ if (psf->loop_info)
-+ { psf_log_printf (psf, " Found existing loop info, using last
one.\n") ;
-+ free (psf->loop_info) ;
-+ psf->loop_info = NULL ;
-+ } ;
- if ((psf->loop_info = calloc (1, sizeof (SF_LOOP_INFO))) == NULL)
- return SFE_MALLOC_FAILED ;
-
Index: patches/patch-src_caf_c
===================================================================
RCS file: patches/patch-src_caf_c
diff -N patches/patch-src_caf_c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_caf_c 20 Feb 2021 01:41:27 -0000
@@ -0,0 +1,19 @@
+$OpenBSD$
+
+Fix memory leak in caf_read_header().
+
+Index: src/caf.c
+--- src/caf.c.orig
++++ src/caf.c
+@@ -416,6 +416,11 @@ caf_read_header (SF_PRIVATE *psf)
+ return SFE_CAF_BAD_PEAK ;
+ } ;
+
++ if (psf->peak_info)
++ { psf_log_printf (psf, "*** Found existing
peak info, using last one.\n") ;
++ free (psf->peak_info) ;
++ psf->peak_info = NULL ;
++ } ;
+ if ((psf->peak_info = peak_info_calloc
(psf->sf.channels)) == NULL)
+ return SFE_MALLOC_FAILED ;
+
Index: patches/patch-src_double64_c
===================================================================
RCS file: patches/patch-src_double64_c
diff -N patches/patch-src_double64_c
--- patches/patch-src_double64_c 13 Feb 2021 06:31:07 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,16 +0,0 @@
-$OpenBSD: patch-src_double64_c,v 1.1 2021/02/13 06:31:07 rsadowski Exp $
-
-Fix use of uninitialized value in endswap_int64_t_array.
-
-Index: src/double64.c
---- src/double64.c.orig
-+++ src/double64.c
-@@ -631,7 +631,7 @@ host_read_d2f (SF_PRIVATE *psf, float *ptr, sf_count_t
- readcount = psf_fread (ubuf.dbuf, sizeof (double), bufferlen,
psf) ;
-
- if (psf->data_endswap == SF_TRUE)
-- endswap_double_array (ubuf.dbuf, bufferlen) ;
-+ endswap_double_array (ubuf.dbuf, readcount) ;
-
- d2f_array (ubuf.dbuf, readcount, ptr + total) ;
- total += readcount ;
Index: patches/patch-src_ima_adpcm_c
===================================================================
RCS file: patches/patch-src_ima_adpcm_c
diff -N patches/patch-src_ima_adpcm_c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_ima_adpcm_c 20 Feb 2021 01:41:39 -0000
@@ -0,0 +1,21 @@
+$OpenBSD$
+
+Make sure that there's enough space to store decoded nibbles in when reading
IMA ADPCM data.
+
+Index: src/ima_adpcm.c
+--- src/ima_adpcm.c.orig
++++ src/ima_adpcm.c
+@@ -182,7 +182,12 @@ ima_reader_init (SF_PRIVATE *psf, int blockalign, int
+ if (psf->file.mode != SFM_READ)
+ return SFE_BAD_MODE_RW ;
+
+- pimasize = sizeof (IMA_ADPCM_PRIVATE) + blockalign * psf->sf.channels + 3
* psf->sf.channels * samplesperblock ;
++ /*
++ ** Allocate enough space for 1 more than a multiple of 8 samples
++ ** to avoid having to branch when pulling apart the nibbles.
++ */
++ count = ((samplesperblock - 2) | 7) + 2 ;
++ pimasize = sizeof (IMA_ADPCM_PRIVATE) + psf->sf.channels * (blockalign
+ samplesperblock + sizeof(short) * count) ;
+
+ if (! (pima = calloc (1, pimasize)))
+ return SFE_MALLOC_FAILED ;
Index: patches/patch-src_sndfile_c
===================================================================
RCS file: patches/patch-src_sndfile_c
diff -N patches/patch-src_sndfile_c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_sndfile_c 20 Feb 2021 01:41:49 -0000
@@ -0,0 +1,24 @@
+$OpenBSD$
+
+Jump back to the start of guess_file_type() rather than recursing into it.
+
+Index: src/sndfile.c
+--- src/sndfile.c.orig
++++ src/sndfile.c
+@@ -2680,6 +2680,7 @@ static int
+ guess_file_type (SF_PRIVATE *psf)
+ { uint32_t buffer [3], format ;
+
++retry:
+ if (psf_binheader_readf (psf, "b", &buffer, SIGNED_SIZEOF (buffer)) !=
SIGNED_SIZEOF (buffer))
+ { psf->error = SFE_BAD_FILE_READ ;
+ return 0 ;
+@@ -2780,7 +2781,7 @@ guess_file_type (SF_PRIVATE *psf)
+ || buffer [0] == MAKE_MARKER ('I', 'D', '3', 4))
+ { psf_log_printf (psf, "Found 'ID3' marker.\n") ;
+ if (id3_skip (psf))
+- return guess_file_type (psf) ;
++ goto retry ;
+ return 0 ;
+ } ;
+
Index: patches/patch-src_svx_c
===================================================================
RCS file: patches/patch-src_svx_c
diff -N patches/patch-src_svx_c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_svx_c 20 Feb 2021 01:42:02 -0000
@@ -0,0 +1,17 @@
+$OpenBSD$
+
+Jump forwards to the next 4 byte aligned offset rather than always jumping
backwards by 3 bytes.
+
+Index: src/svx.c
+--- src/svx.c.orig
++++ src/svx.c
+@@ -307,7 +307,8 @@ svx_read_header (SF_PRIVATE *psf)
+ if ((chunk_size = psf_ftell (psf)) &
0x03)
+ { psf_log_printf (psf, " Unknown
chunk marker at position %d. Resynching.\n", chunk_size - 4) ;
+
+- psf_binheader_readf (psf, "j",
-3) ;
++ chunk_size = chunk_size & 3 ;
++ psf_binheader_readf (psf, "j",
4 - chunk_size) ;
+ break ;
+ } ;
+ psf_log_printf (psf, "*** Unknown chunk
marker (%X) at position %D. Exiting parser.\n", marker, psf_ftell (psf) - 8) ;
Index: patches/patch-src_wav_c
===================================================================
RCS file: patches/patch-src_wav_c
diff -N patches/patch-src_wav_c
--- patches/patch-src_wav_c 13 Feb 2021 06:31:07 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,74 +0,0 @@
-$OpenBSD: patch-src_wav_c,v 1.2 2021/02/13 06:31:07 rsadowski Exp $
-
-- Fix memory leak in wav_read_smpl_chunk().
-- Fix leak in wav_read_header.
-- Fix memory leak in wav_read_acid_chunk.
-- Improve handling of SMPL chunks in WAV files.
-
-Index: src/wav.c
---- src/wav.c.orig
-+++ src/wav.c
-@@ -481,6 +481,11 @@ wav_read_header (SF_PRIVATE *psf, int *blockalign, int
-
- psf_log_printf (psf, " Count :
%d\n", cue_count) ;
-
-+ if (psf->cues)
-+ { free (psf->cues) ;
-+ psf->cues = NULL ;
-+ } ;
-+
- if ((psf->cues = psf_cues_alloc
(cue_count)) == NULL)
- return
SFE_MALLOC_FAILED ;
-
-@@ -1289,7 +1294,7 @@ wav_command (SF_PRIVATE *psf, int command, void * UNUS
- static int
- wav_read_smpl_chunk (SF_PRIVATE *psf, uint32_t chunklen)
- { char buffer [512] ;
-- uint32_t thisread, bytesread = 0, dword, sampler_data, loop_count ;
-+ uint32_t thisread, bytesread = 0, dword, sampler_data, loop_count,
actually_loop_count = 0 ;
- uint32_t note, pitch, start, end, type = -1, count ;
- int j, k ;
-
-@@ -1335,6 +1340,11 @@ wav_read_smpl_chunk (SF_PRIVATE *psf, uint32_t chunkle
- */
- bytesread += psf_binheader_readf (psf, "4", &sampler_data) ;
-
-+ if (psf->instrument)
-+ { psf_log_printf (psf, " Found more than one SMPL chunk, using last
one.\n") ;
-+ free (psf->instrument) ;
-+ psf->instrument = NULL ;
-+ } ;
- if ((psf->instrument = psf_instrument_alloc ()) == NULL)
- return SFE_MALLOC_FAILED ;
-
-@@ -1381,8 +1391,17 @@ wav_read_smpl_chunk (SF_PRIVATE *psf, uint32_t chunkle
- break ;
- } ;
- } ;
-+ actually_loop_count ++ ;
-+ } ;
-
-- loop_count -- ;
-+ if (actually_loop_count > ARRAY_LEN (psf->instrument->loops))
-+ {
-+ psf_log_printf (psf, "*** Warning, actual Loop Points count exceeds %u, changing
Loop Count from %u to %u\n", ARRAY_LEN (psf->instrument->loops), loop_count, ARRAY_LEN
(psf->instrument->loops)) ;
-+ psf->instrument->loop_count = ARRAY_LEN
(psf->instrument->loops) ;
-+ }
-+ else if (loop_count != actually_loop_count)
-+ { psf_log_printf (psf, "*** Warning, actual Loop Points count != Loop
Count, changing Loop Count from %u to %u\n", loop_count, actually_loop_count) ;
-+ psf->instrument->loop_count = actually_loop_count ;
- } ;
-
- if (chunklen - bytesread == 0)
-@@ -1486,6 +1505,11 @@ wav_read_acid_chunk (SF_PRIVATE *psf, uint32_t chunkle
-
- psf_binheader_readf (psf, "j", chunklen - bytesread) ;
-
-+ if (psf->loop_info)
-+ { psf_log_printf (psf, " Found existing loop info, using last
one.\n") ;
-+ free (psf->loop_info) ;
-+ psf->loop_info = NULL ;
-+ } ;
- if ((psf->loop_info = calloc (1, sizeof (SF_LOOP_INFO))) == NULL)
- return SFE_MALLOC_FAILED ;
-
Index: patches/patch-src_wavlike_c
===================================================================
RCS file: patches/patch-src_wavlike_c
diff -N patches/patch-src_wavlike_c
--- patches/patch-src_wavlike_c 16 Jan 2021 12:54:12 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,43 +0,0 @@
-$OpenBSD: patch-src_wavlike_c,v 1.1 2021/01/16 12:54:12 sthen Exp $
-
-- Fix leak in wavlike_read_cart_chunk.
-- Fix memory leak in wavlike_read_peak_chunk.
-- Fix use of uninitialized value in exif_subchunk_parse.
-
-Index: src/wavlike.c
---- src/wavlike.c.orig
-+++ src/wavlike.c
-@@ -838,6 +838,12 @@ wavlike_read_cart_chunk (SF_PRIVATE *psf, uint32_t chu
-
- psf_log_printf (psf, "cart : %u\n", chunksize) ;
-
-+ if (psf->cart_16k)
-+ { psf_log_printf (psf, " Found more than one cart chunk, using last
one.\n") ;
-+ free (psf->cart_16k) ;
-+ psf->cart_16k = NULL ;
-+ } ;
-+
- if ((psf->cart_16k = cart_var_alloc ()) == NULL)
- { psf->error = SFE_MALLOC_FAILED ;
- return psf->error ;
-@@ -1187,6 +1193,11 @@ wavlike_read_peak_chunk (SF_PRIVATE * psf, size_t chun
- return SFE_WAV_BAD_PEAK ;
- } ;
-
-+ if (psf->peak_info)
-+ { psf_log_printf (psf, "*** Found existing peak info, using last
one.\n") ;
-+ free (psf->peak_info) ;
-+ psf->peak_info = NULL ;
-+ } ;
- if ((psf->peak_info = peak_info_calloc (psf->sf.channels)) == NULL)
- return SFE_MALLOC_FAILED ;
-
-@@ -1258,7 +1269,7 @@ exif_fill_and_sink (SF_PRIVATE *psf, char* buf, size_t
- */
- static int
- exif_subchunk_parse (SF_PRIVATE *psf, uint32_t length)
--{ uint32_t marker, dword, vmajor = -1, vminor = -1, bytesread = 0 ;
-+{ uint32_t marker, dword = 0, vmajor = -1, vminor = -1, bytesread = 0 ;
- char buf [4096] ;
- int thisread ;
-
Index: pkg/PLIST
===================================================================
RCS file: /home/cvs/ports/audio/libsndfile/pkg/PLIST,v
retrieving revision 1.14
diff -u -p -u -p -r1.14 PLIST
--- pkg/PLIST 16 Jan 2021 12:53:12 -0000 1.14
+++ pkg/PLIST 20 Feb 2021 01:14:30 -0000
@@ -31,19 +31,19 @@ lib/pkgconfig/sndfile.pc
@man man/man1/sndfile-play.1
@man man/man1/sndfile-salvage.1
share/doc/libsndfile/
-share/doc/libsndfile/FAQ.html
-share/doc/libsndfile/api.html
-share/doc/libsndfile/bugs.html
-share/doc/libsndfile/command.html
-share/doc/libsndfile/embedded_files.html
-share/doc/libsndfile/formats.html
-share/doc/libsndfile/index.html
+share/doc/libsndfile/FAQ.md
+share/doc/libsndfile/api.md
+share/doc/libsndfile/bugs.md
+share/doc/libsndfile/command.md
+share/doc/libsndfile/embedded_files.md
+share/doc/libsndfile/formats.md
+share/doc/libsndfile/index.md
share/doc/libsndfile/libsndfile.css
share/doc/libsndfile/libsndfile.jpg
-share/doc/libsndfile/lists.html
-share/doc/libsndfile/new_file_type.HOWTO
-share/doc/libsndfile/octave.html
+share/doc/libsndfile/lists.md
+share/doc/libsndfile/new_file_type_howto.md
+share/doc/libsndfile/octave.md
share/doc/libsndfile/print.css
-share/doc/libsndfile/sndfile_info.html
-share/doc/libsndfile/tutorial.html
-share/doc/libsndfile/win32.html
+share/doc/libsndfile/sndfile_info.md
+share/doc/libsndfile/tutorial.md
+share/doc/libsndfile/win32.md