]> git.baikalelectronics.ru Git - kernel.git/commit
ALSA: pcm: oss: Avoid plugin buffer overflow
authorTakashi Iwai <tiwai@suse.de>
Mon, 9 Mar 2020 08:21:48 +0000 (09:21 +0100)
committerTakashi Iwai <tiwai@suse.de>
Mon, 9 Mar 2020 08:22:22 +0000 (09:22 +0100)
commit5028daa3ed6b3419b906c0ac52fc2eda2756e96b
tree6da14e501b136c80f46c2ffbd5135708a528cf71
parent49451551f03587163574b52729227016a2d42736
ALSA: pcm: oss: Avoid plugin buffer overflow

Each OSS PCM plugins allocate its internal buffer per pre-calculation
of the max buffer size through the chain of plugins (calling
src_frames and dst_frames callbacks).  This works for most plugins,
but the rate plugin might behave incorrectly.  The calculation in the
rate plugin involves with the fractional position, i.e. it may vary
depending on the input position.  Since the buffer size
pre-calculation is always done with the offset zero, it may return a
shorter size than it might be; this may result in the out-of-bound
access as spotted by fuzzer.

This patch addresses those possible buffer overflow accesses by simply
setting the upper limit per the given buffer size for each plugin
before src_frames() and after dst_frames() calls.

Reported-by: syzbot+e1fe9f44fb8ecf4fb5dd@syzkaller.appspotmail.com
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/000000000000b25ea005a02bcf21@google.com
Link: https://lore.kernel.org/r/20200309082148.19855-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/core/oss/pcm_plugin.c