Skip to content
Snippets Groups Projects
Commit 9ea08eae authored by Akhila musunuri's avatar Akhila musunuri
Browse files

ALSA: compress: fix an integer overflow check


I previously added an integer overflow check here but looking at it now,
it's still buggy.

The bug happens in snd_compr_allocate_buffer().  We multiply
".fragments" and ".fragment_size" and that doesn't overflow but then we
save it in an unsigned int so it truncates the high bits away and we
allocate a smaller than expected size.

Change-Id: Ifaeca85636bee6d5587009170d0539b31fe9b340
Fixes: b35cc822 ('ALSA: compress_core: integer overflow in snd_compr_allocate_buffer()')
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
Git-commit: 6217e5ed
Git-repo: http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git


Signed-off-by: default avatarRavi Kumar Siddojigari <rsiddoji@codeaurora.org>
parent 7c6006ed
No related branches found
No related tags found
No related merge requests found
......@@ -496,7 +496,7 @@ static int snd_compress_check_input(struct snd_compr_params *params)
{
/* first let's check the buffer parameter's */
if (params->buffer.fragment_size == 0 ||
params->buffer.fragments > SIZE_MAX / params->buffer.fragment_size)
params->buffer.fragments > INT_MAX / params->buffer.fragment_size)
return -EINVAL;
/* now codec parameters */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment