shithub: sox

Download patch

ref: 6b6a2930b70fe488ec9ae0c0e6c7c279733c6315
parent: 8c2be5c74c6d10b1470812a8c9d0db88a595cc8b
author: Mans Rullgard <mans@mansr.com>
date: Fri Apr 27 20:53:45 EDT 2018

wav: disallow zero-size chunks [bug #278]

A zero-size chunk is a sign of a corrupt file, so stop reading if
one is encountered.

--- a/src/wav.c
+++ b/src/wav.c
@@ -470,7 +470,7 @@
         if ((*len) % 2) (*len)++;
 
         /* skip to next chunk */
-        if (*len > 0 && lsx_seeki(ft, (off_t)(*len), SEEK_CUR) != SOX_SUCCESS)
+        if (!*len || lsx_seeki(ft, (off_t)(*len), SEEK_CUR) != SOX_SUCCESS)
         {
             lsx_fail_errno(ft,SOX_EHDR,
                           "WAV chunk appears to have invalid size %ld.", *len);