Date: Wed, 5 Jun 2019 15:23:49 +0000 (UTC) From: Ed Maste <emaste@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r348692 - head/usr.bin/vtfontcvt Message-ID: <201906051523.x55FNnAk086952@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: emaste Date: Wed Jun 5 15:23:48 2019 New Revision: 348692 URL: https://svnweb.freebsd.org/changeset/base/348692 Log: vtfontcvt: exit on error if the input font has too many glyphs The kernel has a limit of 131072 glyphs in a font; add the same check to vtfontcvt so that we won't create a font file that the kernel will not load. PR: 205707 Submitted by: Dmitry Wagin MFC after: 2 weeks Modified: head/usr.bin/vtfontcvt/vtfontcvt.c Modified: head/usr.bin/vtfontcvt/vtfontcvt.c ============================================================================== --- head/usr.bin/vtfontcvt/vtfontcvt.c Wed Jun 5 14:23:10 2019 (r348691) +++ head/usr.bin/vtfontcvt/vtfontcvt.c Wed Jun 5 15:23:48 2019 (r348692) @@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$"); #define VFNT_MAP_NORMAL_RH 1 #define VFNT_MAP_BOLD 2 #define VFNT_MAP_BOLD_RH 3 +#define VFNT_MAXGLYPHS 131072 #define VFNT_MAXDIMENSION 128 static unsigned int width = 8, wbytes, height = 16; @@ -184,6 +185,8 @@ add_glyph(const uint8_t *bytes, unsigned int map_idx, SLIST_INSERT_HEAD(&glyph_hash[hash], gl, g_hash); glyph_unique++; + if (glyph_unique > VFNT_MAXGLYPHS) + errx(1, "too many glyphs (%u)", glyph_unique); return (gl); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201906051523.x55FNnAk086952>