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

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