[alsa-devel] Fix bug in arecord --max-file-time where the file size could overflow 32 bits

John Sauter John_Sauter at systemeyescomputerstore.com
Sat Jun 24 10:39:19 CEST 2017


> Date: Fri, 23 Jun 2017 18:35:03 +0000
> From: "Gilliland, Scott M" <scott.gilliland at gatech.edu>
> To: "alsa-devel at alsa-project.org" <alsa-devel at alsa-project.org>
> Subject: [alsa-devel] [PATCH] Fix bug in arecord --max-file-time
> where
> 	the file size could overflow 32 bits
> Message-ID:
> 	<CY4PR07MB3544F3467606CB0401C3F0918DD80 at CY4PR07MB3544.namprd07.
> prod.outlook.com>
> 	
> Content-Type: text/plain; charset="iso-8859-1"
> 
> From: Scott Gilliland <scott.gilliland at gatech.edu>
> 
> Fix bug in arecord --max-file-time where the file size could overflow
> 32 bits
> 
> Signed-off-by: Scott Gilliland <scott.gilliland at gatech.edu>
> ---
>  aplay/aplay.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/aplay/aplay.c b/aplay/aplay.c
> index f793c82..00af662 100644
> --- a/aplay/aplay.c
> +++ b/aplay/aplay.c
> @@ -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,
>                                     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.

Acked-by: John Sauter <John_Sauter at systemeyescomputerstore.com>

-- 
PGP fingerprint E24A D25B E5FE 4914 A603  49EC 7030 3EA1 9A0B 511E
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: This is a digitally signed message part
URL: <http://mailman.alsa-project.org/pipermail/alsa-devel/attachments/20170624/c72a8363/attachment.sig>


More information about the Alsa-devel mailing list