All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch] ALSA: compress_core: integer overflow in snd_compr_allocate_buffer()
@ 2012-09-05 12:32 ` Dan Carpenter
  0 siblings, 0 replies; 22+ messages in thread
From: Dan Carpenter @ 2012-09-05 12:32 UTC (permalink / raw)
  To: Vinod Koul
  Cc: alsa-devel, Takashi Iwai, kernel-janitors, Pierre-Louis Bossart,
	Jesper Juhl, Namarta Kohli

These are 32 bit values that come from the user, we need to check for
integer overflows or we could end up allocating a smaller buffer than
expected.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/sound/core/compress_offload.c b/sound/core/compress_offload.c
index ec2118d..5a733e7 100644
--- a/sound/core/compress_offload.c
+++ b/sound/core/compress_offload.c
@@ -409,6 +409,10 @@ static int snd_compr_allocate_buffer(struct snd_compr_stream *stream,
 	unsigned int buffer_size;
 	void *buffer;
 
+	if (params->buffer.fragment_size == 0 ||
+	    params->buffer.fragments > SIZE_MAX / params->buffer.fragment_size)
+		return -EINVAL;
+
 	buffer_size = params->buffer.fragment_size * params->buffer.fragments;
 	if (stream->ops->copy) {
 		buffer = NULL;

^ permalink raw reply related	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2012-09-14 10:00 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-05 12:32 [patch] ALSA: compress_core: integer overflow in snd_compr_allocate_buffer() Dan Carpenter
2012-09-05 12:32 ` Dan Carpenter
2012-09-05 13:40 ` Takashi Iwai
2012-09-05 13:40   ` Takashi Iwai
2012-09-06 14:59   ` Dan Carpenter
2012-09-06 14:59     ` Dan Carpenter
2012-09-06 15:19     ` Takashi Iwai
2012-09-06 15:19       ` Takashi Iwai
2012-09-14  9:06       ` Takashi Iwai
2012-09-14  9:06         ` Takashi Iwai
2012-09-14  9:24         ` Vinod Koul
2012-09-14  9:36           ` Vinod Koul
2012-09-14  9:28           ` Vinod Koul
2012-09-14  9:40             ` Vinod Koul
2012-09-14  9:45             ` Takashi Iwai
2012-09-14  9:45               ` Takashi Iwai
2012-09-14  9:49               ` Vinod Koul
2012-09-14  9:52                 ` Vinod Koul
2012-09-14 10:00                 ` Takashi Iwai
2012-09-14 10:00                   ` Takashi Iwai
2012-09-14  9:35           ` Dan Carpenter
2012-09-14  9:35             ` Dan Carpenter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.