Unverified Commit b6d06231 authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!1162 fbcon: Check font dimension limits

parents 671291b4 aa4e4b8d
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -2513,9 +2513,12 @@ static int fbcon_set_font(struct vc_data *vc, struct console_font *font,
	    h > FBCON_SWAP(info->var.rotate, info->var.yres, info->var.xres))
		return -EINVAL;

	if (font->width > 32 || font->height > 32)
		return -EINVAL;

	/* Make sure drawing engine can handle the font */
	if (!(info->pixmap.blit_x & (1 << (font->width - 1))) ||
	    !(info->pixmap.blit_y & (1 << (font->height - 1))))
	if (!(info->pixmap.blit_x & BIT(font->width - 1)) ||
	    !(info->pixmap.blit_y & BIT(font->height - 1)))
		return -EINVAL;

	/* Make sure driver can handle the font length */