]> git.baikalelectronics.ru Git - kernel.git/commit
media: mediatek: vcodec: Fix potential array out-of-bounds in decoder queue_setup
authorWei Chen <harperchen1110@gmail.com>
Wed, 29 Mar 2023 08:05:13 +0000 (09:05 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 24 May 2023 16:32:36 +0000 (17:32 +0100)
commit59f7a1bd058eec7eda616e7c2bd5d0c7f549d717
tree032dffea0d6248aa03fb860d8017e2c82a8e3cd7
parente655ce8972eef7c7fc8e8ce49e0b3e3f3552ada0
media: mediatek: vcodec: Fix potential array out-of-bounds in decoder queue_setup

[ Upstream commit 8fbcf730cb89c3647f3365226fe7014118fa93c7 ]

variable *nplanes is provided by user via system call argument. The
possible value of q_data->fmt->num_planes is 1-3, while the value
of *nplanes can be 1-8. The array access by index i can cause array
out-of-bounds.

Fix this bug by checking *nplanes against the array size.

Signed-off-by: Wei Chen <harperchen1110@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c