Skip to content

Commit

Permalink
[media] vivid: fix buffer overrun
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Hans Verkuil authored and Mauro Carvalho Chehab committed Oct 21, 2014
1 parent a0bd3e0 commit c204e1f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/media/platform/vivid/vivid-tpg.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ int tpg_alloc(struct tpg_data *tpg, unsigned max_w)
tpg->black_line[plane] = vzalloc(max_w * pixelsz);
if (!tpg->black_line[plane])
return -ENOMEM;
tpg->random_line[plane] = vzalloc(max_w * pixelsz);
tpg->random_line[plane] = vzalloc(max_w * 2 * pixelsz);
if (!tpg->random_line[plane])
return -ENOMEM;
}
Expand Down

0 comments on commit c204e1f

Please sign in to comment.