Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 8 Apr 2018 20:30:52 +0000 (UTC)
From:      Ed Maste <emaste@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: r332302 - stable/11/usr.bin/vtfontcvt
Message-ID:  <201804082030.w38KUq0s023381@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: emaste
Date: Sun Apr  8 20:30:52 2018
New Revision: 332302
URL: https://svnweb.freebsd.org/changeset/base/332302

Log:
  MFC r331935: vtfontcvt: allow .bdf characters less than full height
  
  Sponsored by:	The FreeBSD Foundation

Modified:
  stable/11/usr.bin/vtfontcvt/vtfontcvt.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.bin/vtfontcvt/vtfontcvt.c
==============================================================================
--- stable/11/usr.bin/vtfontcvt/vtfontcvt.c	Sun Apr  8 20:28:37 2018	(r332301)
+++ stable/11/usr.bin/vtfontcvt/vtfontcvt.c	Sun Apr  8 20:30:52 2018	(r332302)
@@ -265,10 +265,23 @@ parse_bdf(FILE *fp, unsigned int map_idx)
 
 		if (strncmp(ln, "BITMAP", 6) == 0 &&
 		    (ln[6] == ' ' || ln[6] == '\0')) {
+			/*
+			 * Assume that the next _height_ lines are bitmap
+			 * data.  ENDCHAR is allowed to terminate the bitmap
+			 * early but is not otherwise checked; any extra data
+			 * is ignored.
+			 */
 			for (i = 0; i < height; i++) {
 				if ((ln = fgetln(fp, &length)) == NULL)
 					errx(1, "Unexpected EOF!\n");
 				ln[length - 1] = '\0';
+				if (strcmp(ln, "ENDCHAR") == 0) {
+					memset(bytes + i * wbytes, 0,
+					    (height - i) * wbytes);
+					memset(bytes_r + i * wbytes, 0,
+					    (height - i) * wbytes);
+					break;
+				}
 				sscanf(ln, "%x", &line);
 				if (parse_bitmap_line(bytes + i * wbytes,
 				     bytes_r + i * wbytes, line, dwidth) != 0)



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