Skip to content

Commit e0d7c7a

Browse files
avasummerUlrich Hecht
authored andcommitted
ALSA: wavefront: Fix integer overflow in sample size validation
[ Upstream commit 0c4a13ba88594fd4a27292853e736c6b4349823d ] The wavefront_send_sample() function has an integer overflow issue when validating sample size. The header->size field is u32 but gets cast to int for comparison with dev->freemem Fix by using unsigned comparison to avoid integer overflow. Fixes: 1da177e ("Linux-2.6.12-rc2") Cc: stable@vger.kernel.org Signed-off-by: Junrui Luo <moonafterrain@outlook.com> Link: https://patch.msgid.link/SYBPR01MB7881B47789D1B060CE8BF4C3AFC2A@SYBPR01MB7881.ausprd01.prod.outlook.com Signed-off-by: Takashi Iwai <tiwai@suse.de> [ Adjust context ] Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Ulrich Hecht <uli@kernel.org>
1 parent 647f257 commit e0d7c7a

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

sound/isa/wavefront/wavefront_synth.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -948,9 +948,9 @@ wavefront_send_sample (snd_wavefront_t *dev,
948948
if (header->size) {
949949
dev->freemem = wavefront_freemem (dev);
950950

951-
if (dev->freemem < (int)header->size) {
951+
if (dev->freemem < 0 || dev->freemem < header->size) {
952952
snd_printk ("insufficient memory to "
953-
"load %d byte sample.\n",
953+
"load %u byte sample.\n",
954954
header->size);
955955
return -ENOMEM;
956956
}

0 commit comments

Comments
 (0)