diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2014-10-07 07:58:55 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2014-10-21 06:52:11 -0400 |
commit | c204e1fafbd50a158a34c8a5bd9682cb04ecb29b (patch) | |
tree | 5a461b1684158d34930839266731efd7978c6502 /drivers/media | |
parent | a0bd3e0b31500251876da505295834e73f33f6f8 (diff) |
[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>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/platform/vivid/vivid-tpg.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/media/platform/vivid/vivid-tpg.c b/drivers/media/platform/vivid/vivid-tpg.c index 0c6fa53fa646..cbcd6250e7b2 100644 --- a/drivers/media/platform/vivid/vivid-tpg.c +++ b/drivers/media/platform/vivid/vivid-tpg.c | |||
@@ -136,7 +136,7 @@ int tpg_alloc(struct tpg_data *tpg, unsigned max_w) | |||
136 | tpg->black_line[plane] = vzalloc(max_w * pixelsz); | 136 | tpg->black_line[plane] = vzalloc(max_w * pixelsz); |
137 | if (!tpg->black_line[plane]) | 137 | if (!tpg->black_line[plane]) |
138 | return -ENOMEM; | 138 | return -ENOMEM; |
139 | tpg->random_line[plane] = vzalloc(max_w * pixelsz); | 139 | tpg->random_line[plane] = vzalloc(max_w * 2 * pixelsz); |
140 | if (!tpg->random_line[plane]) | 140 | if (!tpg->random_line[plane]) |
141 | return -ENOMEM; | 141 | return -ENOMEM; |
142 | } | 142 | } |