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

23d2ea
From 002c7908388cea822217b6a907de419676d6e4b8 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
27a4da
Subject: [PATCH 083/260] * util/grub-gen-asciih.c (add_glyph): Fix
39700a
 uninitialised variable.
39700a
39700a
---
39700a
 ChangeLog              |  4 ++++
39700a
 util/grub-gen-asciih.c | 15 +++++++++------
39700a
 2 files changed, 13 insertions(+), 6 deletions(-)
39700a
39700a
diff --git a/ChangeLog b/ChangeLog
27a4da
index 2a94ad979..b55211308 100644
39700a
--- a/ChangeLog
39700a
+++ b/ChangeLog
39700a
@@ -1,3 +1,7 @@
39700a
+2014-06-21  Trevor Woerner <trevor.woerner@linaro.org>
39700a
+
39700a
+	* util/grub-gen-asciih.c (add_glyph): Fix uninitialised variable.
39700a
+
39700a
 2014-06-21  Vladimir Serbinenko  <phcoder@gmail.com>
39700a
 
39700a
 	* grub-core/commands/verify.c (grub_pubkey_open): Trust procfs.
39700a
diff --git a/util/grub-gen-asciih.c b/util/grub-gen-asciih.c
27a4da
index e01447ae9..e35dcb78f 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
39700a
-- 
27a4da
2.13.0
39700a