Skip to content

Commit

Permalink
vtfontcvt: improve .bdf verification
Browse files Browse the repository at this point in the history
Previously we would crash if the BBX y-offset was outside of the font
bounding box.

Reported by:	afl
MFC with:	r349100
Event:		Berlin Devsummit 2019
Sponsored by:	The FreeBSD Foundation
  • Loading branch information
emaste committed Jun 16, 2019
1 parent a9065ba commit 5703640
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion usr.bin/vtfontcvt/vtfontcvt.c
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,8 @@ parse_bdf(FILE *fp, unsigned int map_idx)
sscanf(ln + 4, "%d %d %d %d", &bbw, &bbh, &bbox,
&bboy) == 4) {
if (bbw < 1 || bbh < 1 || bbw > fbbw || bbh > fbbh ||
bbox < fbbox || bboy < fbboy)
bbox < fbbox || bboy < fbboy ||
bbh + bboy > fbbh + fbboy)
errx(1, "broken bitmap with BBX %d %d %d %d at line %u",
bbw, bbh, bbox, bboy, linenum);
bbwbytes = howmany(bbw, 8);
Expand Down

0 comments on commit 5703640

Please sign in to comment.