Skip to contentSkip to conversation

Fix bug in arecord --max-file-time where the file size could overflow 32 bits

DISCUSSION John Sauter 1 participant 1 message Jun 24, 2017 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

John Sauter

author Acked-by
#1 lore raw
Quoted 34 lines

Date: Fri, 23 Jun 2017 18:35:03 +0000
From: "Gilliland, Scott M" <[email protected]>
To: "[email protected]" <[email protected]>
Subject: [alsa-devel] [PATCH] Fix bug in arecord --max-file-time where
the file size could overflow 32 bits
Message-ID:

	<[email protected].

prod.outlook.com>

Content-Type: text/plain; charset="iso-8859-1"

From: Scott Gilliland <[email protected]>

Fix bug in arecord --max-file-time where the file size could overflow 32 bits

---
 aplay/aplay.c | 2 +-

 1 file changed, 1 insertion(+), 1 deletion(-)
aplay/aplay.c +1 -1
index f793c82..00af662 100644
@@ -3027,7 +3027,7 @@ static void capture(char *orig_name)
         if (count == 0)
                 count = LLONG_MAX;
         /* compute the number of bytes per file */
-       max_file_size = max_file_time *
+       max_file_size = (long long) max_file_time *
                 snd_pcm_format_size(hwparams.format,
Quoted 6 lines

                                    hwparams.rate * hwparams.channels);
        /* WAVE-file should be even (I'm not sure), but wasting one byte
--
2.11.0

Thank you for fixing this bug, which I introduced in 2010 through failing to understand the type conversion rules of C.

Signature · 1 line
PGP fingerprint E24A D25B E5FE 4914 A603  49EC 7030 3EA1 9A0B 511E