Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 4 Apr 2018 05:24:59 +0000 (UTC)
From:      Gordon Tetlow <gordon@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r331982 - stable/11/sys/dev/vt
Message-ID:  <201804040524.w345OxMx096193@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: gordon
Date: Wed Apr  4 05:24:59 2018
New Revision: 331982
URL: https://svnweb.freebsd.org/changeset/base/331982

Log:
  MFC r331981:
  
  Limit glyph count in vtfont_load to avoid integer overflow.
  
  Invalid font data passed to PIO_VFONT can result in an integer overflow
  in glyphsize.  Characters may then be drawn on the console using glyph
  map entries that point beyond the end of allocated glyph memory,
  resulting in a kernel memory disclosure.
  
  Submitted by:   emaste
  Reported by:    Dr. Silvio Cesare of InfoSect
  Security:       CVE-2018-6917
  Security:       FreeBSD-SA-18:04.vt
  Sponsored by:   The FreeBSD Foundation

Modified:
  stable/11/sys/dev/vt/vt_font.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/vt/vt_font.c
==============================================================================
--- stable/11/sys/dev/vt/vt_font.c	Wed Apr  4 05:21:46 2018	(r331981)
+++ stable/11/sys/dev/vt/vt_font.c	Wed Apr  4 05:24:59 2018	(r331982)
@@ -42,6 +42,7 @@ static MALLOC_DEFINE(M_VTFONT, "vtfont", "vt font");
 
 /* Some limits to prevent abnormal fonts from being loaded. */
 #define	VTFONT_MAXMAPPINGS	65536
+#define	VTFONT_MAXGLYPHS	131072
 #define	VTFONT_MAXGLYPHSIZE	2097152
 #define	VTFONT_MAXDIMENSION	128
 
@@ -171,7 +172,8 @@ vtfont_load(vfnt_t *f, struct vt_font **ret)
 	/* Make sure the dimensions are valid. */
 	if (f->width < 1 || f->height < 1)
 		return (EINVAL);
-	if (f->width > VTFONT_MAXDIMENSION || f->height > VTFONT_MAXDIMENSION)
+	if (f->width > VTFONT_MAXDIMENSION || f->height > VTFONT_MAXDIMENSION ||
+	    f->glyph_count > VTFONT_MAXGLYPHS)
 		return (E2BIG);
 
 	/* Not too many mappings. */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201804040524.w345OxMx096193>