sox-devel@lists.sourceforge.net unofficial mirror
 help / color / mirror / code / Atom feed
* [PATCH] wav: disallow zero-size chunks [bug #278]
@ 2018-04-27 23:53 Mans Rullgard
  0 siblings, 0 replies; only message in thread
From: Mans Rullgard @ 2018-04-27 23:53 UTC (permalink / raw)
  To: sox-devel

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)
         {
             lsx_fail_errno(ft,SOX_EHDR,
                           "WAV chunk appears to have invalid size %ld.", *len);
-- 
2.17.0


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
SoX-devel mailing list
SoX-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sox-devel

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2018-04-27 23:55 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-27 23:53 [PATCH] wav: disallow zero-size chunks [bug #278] Mans Rullgard

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/sox.git

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).