shithub: sox

Download patch

ref: 4bf2987a7d811612e8b66c9632fc88fc819feb44
parent: f5966723abea540e52bc8916576f0fdf045ba100
author: rrt <rrt>
date: Thu Jan 25 15:13:43 EST 2007

Don't go into endless loop on zero-padded WAVs. Fix from Jorge Serna.

--- a/src/wav.c
+++ b/src/wav.c
@@ -353,10 +353,10 @@
         }
 
         if (strncmp(Label, magic, 4) == 0)
-            break; /* Found the data chunk */
+            break; /* Found the given chunk */
 
         /* skip to next chunk */
-        if (st_seeki(ft, *len, SEEK_CUR) != ST_SUCCESS)
+        if (*len == 0 || st_seeki(ft, *len, SEEK_CUR) != ST_SUCCESS)
         {
             st_fail_errno(ft,ST_EHDR, 
                           "WAV chunk appears to have invalid size %d.", *len);