The diff below replaces a memcpy call with memmove. The supplied buffers
overlap in certain cases, as found by the aborting memcpy. The fix is
also committed upstream.

To reproduce:

$ # you are about to download 134 MB
$ ftp http://www.rarewares.org/wavpack/test_suite.zip
$ unzip test_suite.zip
$ wvunpack -qv test_suite/special_cases/win_executable.wv
Abort trap (core dumped)
$ wvunpack -qv test_suite/special_cases/cue_sheet.wv
Abort trap (core dumped)

Regards,
Tim

Index: Makefile
===================================================================
RCS file: /cvs/ports/audio/wavpack/Makefile,v
retrieving revision 1.15
diff -u -r1.15 Makefile
--- Makefile    19 May 2014 16:57:39 -0000      1.15
+++ Makefile    13 Jan 2015 17:30:09 -0000
@@ -3,7 +3,7 @@
 COMMENT =              audio codec for lossless, lossy and hybrid compression
 
 DISTNAME =             wavpack-4.70.0
-REVISION =             0
+REVISION =             1
 CATEGORIES =           audio
 
 HOMEPAGE =             http://www.wavpack.com/
Index: patches/patch-src_wputils_c
===================================================================
RCS file: patches/patch-src_wputils_c
diff -N patches/patch-src_wputils_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_wputils_c 13 Jan 2015 17:30:09 -0000
@@ -0,0 +1,12 @@
+$OpenBSD$
+--- src/wputils.c.orig Fri Oct 11 05:23:18 2013
++++ src/wputils.c      Tue Jan 13 18:27:52 2015
+@@ -1925,7 +1925,7 @@ static uint32_t read_next_header (WavpackStreamReader 
+     while (1) {
+         if (sp < ep) {
+             bleft = (int)(ep - sp);
+-            memcpy (buffer, sp, bleft);
++            memmove (buffer, sp, bleft);
+         }
+         else
+             bleft = 0;

Reply via email to