From 277506cad41bd18e76e373457a425dcbf4b3c59e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20B=C3=BCnzli?= Date: Fri, 9 May 2014 19:48:53 +0200 Subject: prevent indeterminacy by uninitialized variables There are two issues where variables may be used unitialized: * extract_exif_resolution fails to set xres and yres for JPEG images if there's no valid resolution unit (mainly affects XPS documents) * xps_measure_font_glyph uses hadv and vadv unitialized if the glyph id isn't valid (i.e. if FT_Get_Advance fails) --- source/fitz/load-jpeg.c | 5 +++++ source/xps/xps-glyphs.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'source') diff --git a/source/fitz/load-jpeg.c b/source/fitz/load-jpeg.c index d3701a1e..f3bffd63 100644 --- a/source/fitz/load-jpeg.c +++ b/source/fitz/load-jpeg.c @@ -111,6 +111,11 @@ static int extract_exif_resolution(jpeg_saved_marker_ptr marker, int *xres, int *xres = (int)(x_res * 254 / 100); *yres = (int)(y_res * 254 / 100); } + else + { + *xres = 0; + *yres = 0; + } return 1; } diff --git a/source/xps/xps-glyphs.c b/source/xps/xps-glyphs.c index e621257e..afd9266f 100644 --- a/source/xps/xps-glyphs.c +++ b/source/xps/xps-glyphs.c @@ -56,7 +56,7 @@ xps_measure_font_glyph(xps_document *doc, fz_font *font, int gid, xps_glyph_metr { int mask = FT_LOAD_NO_SCALE | FT_LOAD_IGNORE_TRANSFORM; FT_Face face = font->ft_face; - FT_Fixed hadv, vadv; + FT_Fixed hadv = 0, vadv = 0; fz_context *ctx = doc->ctx; fz_lock(ctx, FZ_LOCK_FREETYPE); -- cgit v1.2.3