From c2fda8f3e4f3623d1766d37078fb05d3ef6dbbe8 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Mon, 24 Aug 2020 19:25:39 +0100 Subject: [PATCH] wav: warn when writing truncated size fields in large files --- src/wav.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/wav.c b/src/wav.c index 8cd87b86..bf7d2714 100644 --- a/src/wav.c +++ b/src/wav.c @@ -1468,6 +1468,10 @@ static int wavwritehdr(sox_format_t * ft, int second_header) lsx_debug(" %d byte/sec, %d block align, %d bits/samp", dwAvgBytesPerSec, wBlockAlign, wBitsPerSample); } else { + if (wRiffLength == UINT32_MAX || dwDataLength == UINT32_MAX || + dwSamplesWritten == UINT32_MAX) + lsx_warn("File too large, writing truncated values in header"); + lsx_debug("Finished writing Wave file, %"PRIu64" data bytes %"PRIu64" samples", dwDataLength, wav->numSamples); #ifdef HAVE_GSM -- 2.11.4.GIT