Skip to content

Commit c204e1f

Browse files
Hans Verkuilmchehab
authored andcommitted
[media] vivid: fix buffer overrun
The random_line buffer must be twice the maximum width, but it only allocated the maximum width, so it was only half the size it needed to be. Surprisingly I never saw the kernel fail on this, but the same TPG code used in qv4l2 crashed and valgrind helped me track this bug down. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
1 parent a0bd3e0 commit c204e1f

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎drivers/media/platform/vivid/vivid-tpg.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ int tpg_alloc(struct tpg_data *tpg, unsigned max_w)
136136
tpg->black_line[plane] = vzalloc(max_w * pixelsz);
137137
if (!tpg->black_line[plane])
138138
return -ENOMEM;
139-
tpg->random_line[plane] = vzalloc(max_w * pixelsz);
139+
tpg->random_line[plane] = vzalloc(max_w * 2 * pixelsz);
140140
if (!tpg->random_line[plane])
141141
return -ENOMEM;
142142
}

0 commit comments

Comments
 (0)