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
[email protected]
https://lists.sourceforge.net/lists/listinfo/sox-devel