diff options
author | Hans Verkuil <hverkuil-cisco@xs4all.nl> | 2018-11-08 19:12:47 +0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab+samsung@kernel.org> | 2018-11-23 14:23:06 +0300 |
commit | e5f71a27fa12c1a1b02ad478a568e76260f1815e (patch) | |
tree | 54e6e280b179c54a8b9eada950f1419a6d6f0046 | |
parent | b01783f801e65243afed9012c12343f5d63920eb (diff) | |
download | linux-e5f71a27fa12c1a1b02ad478a568e76260f1815e.tar.xz |
media: v4l2-tpg: array index could become negative
text[s] is a signed char, so using that as index into the font8x16 array
can result in negative indices. Cast it to u8 to be safe.
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Reported-by: syzbot+ccf0a61ed12f2a7313ee@syzkaller.appspotmail.com
Cc: <stable@vger.kernel.org> # for v4.7 and up
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
-rw-r--r-- | drivers/media/common/v4l2-tpg/v4l2-tpg-core.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c b/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c index fa483b95bc5a..d9a590ae7545 100644 --- a/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c +++ b/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c @@ -1769,7 +1769,7 @@ typedef struct { u16 __; u8 _; } __packed x24; unsigned s; \ \ for (s = 0; s < len; s++) { \ - u8 chr = font8x16[text[s] * 16 + line]; \ + u8 chr = font8x16[(u8)text[s] * 16 + line]; \ \ if (hdiv == 2 && tpg->hflip) { \ pos[3] = (chr & (0x01 << 6) ? fg : bg); \ |