dcavalca / rpms / grub2

Forked from rpms/grub2 3 years ago
Clone

Blame SOURCES/0083-util-grub-gen-asciih.c-add_glyph-Fix-uninitialised-v.patch

28f7f8
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
39700a
From: Trevor Woerner <trevor.woerner@linaro.org>
39700a
Date: Sat, 21 Jun 2014 20:26:47 +0200
28f7f8
Subject: [PATCH] * util/grub-gen-asciih.c (add_glyph): Fix uninitialised
28f7f8
 variable.
39700a
39700a
---
39700a
 util/grub-gen-asciih.c | 15 +++++++++------
28f7f8
 ChangeLog              |  4 ++++
39700a
 2 files changed, 13 insertions(+), 6 deletions(-)
39700a
39700a
diff --git a/util/grub-gen-asciih.c b/util/grub-gen-asciih.c
28f7f8
index e01447ae94f..e35dcb78fe6 100644
39700a
--- a/util/grub-gen-asciih.c
39700a
+++ b/util/grub-gen-asciih.c
39700a
@@ -81,14 +81,14 @@ add_glyph (FT_UInt glyph_idx, FT_Face face,
39700a
   err = FT_Load_Glyph (face, glyph_idx, flag);
39700a
   if (err)
39700a
     {
39700a
-      printf ("Freetype Error %d loading glyph 0x%x for U+0x%x",
39700a
+      fprintf (stderr, "Freetype Error %d loading glyph 0x%x for U+0x%x",
39700a
 	      err, glyph_idx, char_code);
39700a
 
39700a
       if (err > 0 && err < (signed) ARRAY_SIZE (ft_errmsgs))
39700a
-	printf (": %s\n", ft_errmsgs[err]);
39700a
+	fprintf (stderr, ": %s\n", ft_errmsgs[err]);
39700a
       else
39700a
-	printf ("\n");
39700a
-      return;
39700a
+	fprintf (stderr, "\n");
39700a
+      exit (1);
39700a
     }
39700a
 
39700a
   glyph = face->glyph;
39700a
@@ -128,7 +128,6 @@ add_glyph (FT_UInt glyph_idx, FT_Face face,
39700a
 static void
39700a
 write_font_ascii_bitmap (FILE *file, FT_Face face)
39700a
 {
39700a
-  struct grub_glyph_info glyph;
39700a
   int char_code;
39700a
 
39700a
   fprintf (file, "/* THIS CHUNK OF BYTES IS AUTOMATICALLY GENERATED */\n");
39700a
@@ -138,10 +137,14 @@ write_font_ascii_bitmap (FILE *file, FT_Face face)
39700a
   for (char_code = 0; char_code <= 0x7f; char_code++)
39700a
     {
39700a
       FT_UInt glyph_idx;
39700a
-      
39700a
+      struct grub_glyph_info glyph;
39700a
+
39700a
       glyph_idx = FT_Get_Char_Index (face, char_code);
39700a
       if (!glyph_idx)
39700a
 	return;
39700a
+
39700a
+      memset (&glyph, 0, sizeof(glyph));
39700a
+
39700a
       add_glyph (glyph_idx, face, char_code, &glyph);
39700a
 
39700a
       if (glyph.width == 8 && glyph.height == 16
28f7f8
diff --git a/ChangeLog b/ChangeLog
28f7f8
index 2a94ad979b3..b5521130874 100644
28f7f8
--- a/ChangeLog
28f7f8
+++ b/ChangeLog
28f7f8
@@ -1,3 +1,7 @@
28f7f8
+2014-06-21  Trevor Woerner <trevor.woerner@linaro.org>
28f7f8
+
28f7f8
+	* util/grub-gen-asciih.c (add_glyph): Fix uninitialised variable.
28f7f8
+
28f7f8
 2014-06-21  Vladimir Serbinenko  <phcoder@gmail.com>
28f7f8
 
28f7f8
 	* grub-core/commands/verify.c (grub_pubkey_open): Trust procfs.