Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

fbdev: fix potential OOB read in fast_imageblit()

There is a potential OOB read at fast_imageblit, for
"colortab[(*src >> 4)]" can become a negative value due to
"const char *s = image->data, *src".
This change makes sure the index for colortab always positive
or zero.

Similar commit:
https://patchwork.kernel.org/patch/11746067

Potential bug report:
https://groups.google.com/g/syzkaller-bugs/c/9ubBXKeKXf4/m/k-QXy4UgAAAJ

Signed-off-by: Zhang Shurong <zhang_shurong@foxmail.com>
Cc: stable@vger.kernel.org
Signed-off-by: Helge Deller <deller@gmx.de>

authored by

Zhang Shurong and committed by
Helge Deller
c2d22806 29c171de

+1 -1
+1 -1
drivers/video/fbdev/core/sysimgblt.c
··· 189 189 u32 fgx = fgcolor, bgx = bgcolor, bpp = p->var.bits_per_pixel; 190 190 u32 ppw = 32/bpp, spitch = (image->width + 7)/8; 191 191 u32 bit_mask, eorx, shift; 192 - const char *s = image->data, *src; 192 + const u8 *s = image->data, *src; 193 193 u32 *dst; 194 194 const u32 *tab; 195 195 size_t tablen;