mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-30 08:02:30 +00:00
media: v4l2-ctrls.c: fix shift-out-of-bounds in std_validate
commit 048c96e286
upstream.
If a menu has more than 64 items, then don't check menu_skip_mask
for items 65 and up.
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Reported-by: syzbot+42d8c7c3d3e594b34346@syzkaller.appspotmail.com
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
edaa0a0aab
commit
a72c45f4ee
1 changed files with 2 additions and 1 deletions
|
@ -1795,7 +1795,8 @@ static int std_validate(const struct v4l2_ctrl *ctrl, u32 idx,
|
|||
case V4L2_CTRL_TYPE_INTEGER_MENU:
|
||||
if (ptr.p_s32[idx] < ctrl->minimum || ptr.p_s32[idx] > ctrl->maximum)
|
||||
return -ERANGE;
|
||||
if (ctrl->menu_skip_mask & (1ULL << ptr.p_s32[idx]))
|
||||
if (ptr.p_s32[idx] < BITS_PER_LONG_LONG &&
|
||||
(ctrl->menu_skip_mask & BIT_ULL(ptr.p_s32[idx])))
|
||||
return -EINVAL;
|
||||
if (ctrl->type == V4L2_CTRL_TYPE_MENU &&
|
||||
ctrl->qmenu[ptr.p_s32[idx]][0] == '\0')
|
||||
|
|
Loading…
Reference in a new issue