From 5faaa444cb08a19eb9eb932010bb70cb3e3423f4 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Mon, 19 May 2014 13:36:45 +0200 Subject: Fix 694952: Limit Type 3 font glyph bbox size. Don't let a glyph's bbox be too much bigger than the font bbox. --- source/fitz/font.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'source/fitz/font.c') diff --git a/source/fitz/font.c b/source/fitz/font.c index 4e676361..598931e8 100644 --- a/source/fitz/font.c +++ b/source/fitz/font.c @@ -1074,6 +1074,7 @@ fz_bound_t3_glyph(fz_context *ctx, fz_font *font, int gid, const fz_matrix *trm, fz_display_list *list; fz_matrix ctm; fz_device *dev; + fz_rect big; list = font->t3lists[gid]; if (!list) @@ -1097,6 +1098,11 @@ fz_bound_t3_glyph(fz_context *ctx, fz_font *font, int gid, const fz_matrix *trm, fz_rethrow(ctx); } + /* clip the bbox size to a reasonable maximum for degenerate glyphs */ + big = font->bbox; + fz_expand_rect(&big, fz_max(fz_matrix_expansion(&ctm) * 2, fz_max(big.x1 - big.x0, big.y1 - big.y0))); + fz_intersect_rect(bounds, &big); + return bounds; } -- cgit v1.2.3