unofficial mirror
 help / color / mirror / code / Atom feed
From: Mans Rullgard <>
Subject: [PATCH] wav: disallow zero-size chunks [bug #278]
Date: Sat, 28 Apr 2018 00:53:59 +0100	[thread overview]
Message-ID: <> (raw)

A zero-size chunk is a sign of a corrupt file, so stop reading if
one is encountered.
 src/wav.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/wav.c b/src/wav.c
index 3b07e5e25fd3..f868dab4b294 100644
--- a/src/wav.c
+++ b/src/wav.c
@@ -469,7 +469,7 @@ static int findChunk(sox_format_t * ft, const char *Label, uint64_t *len)
         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)
                           "WAV chunk appears to have invalid size %ld.", *len);

Check out the vibrant tech community on one of the world's most
engaging tech sites,!
SoX-devel mailing list

                 reply	other threads:[~2018-04-27 23:55 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:

  List information:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).