nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

Blame SOURCES/0462-grub-core-video-readers-jpeg.c-Avoid-division-by-zer.patch

d18179
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
d18179
From: Vladimir Serbinenko <phcoder@gmail.com>
d18179
Date: Tue, 20 Jan 2015 19:35:49 +0100
d18179
Subject: [PATCH] 	* grub-core/video/readers/jpeg.c: Avoid division by
d18179
 zero.
d18179
d18179
(cherry picked from commit 4816dcac19a05a1209822015d88903faef3d6f44)
d18179
[rharwood: drop ChangeLog]
d18179
Signed-off-by: Robbie Harwood <rharwood@redhat.com>
d18179
---
d18179
 grub-core/video/readers/jpeg.c | 2 +-
d18179
 1 file changed, 1 insertion(+), 1 deletion(-)
d18179
d18179
diff --git a/grub-core/video/readers/jpeg.c b/grub-core/video/readers/jpeg.c
d18179
index a6742a96b1..84cf5ceec9 100644
d18179
--- a/grub-core/video/readers/jpeg.c
d18179
+++ b/grub-core/video/readers/jpeg.c
d18179
@@ -323,7 +323,7 @@ grub_jpeg_decode_sof (struct grub_jpeg_data *data)
d18179
 	{
d18179
 	  data->vs = ss & 0xF;	/* Vertical sampling.  */
d18179
 	  data->hs = ss >> 4;	/* Horizontal sampling.  */
d18179
-	  if ((data->vs > 2) || (data->hs > 2))
d18179
+	  if ((data->vs > 2) || (data->hs > 2) || (data->vs == 0) || (data->hs == 0))
d18179
 	    return grub_error (GRUB_ERR_BAD_FILE_TYPE,
d18179
 			       "jpeg: sampling method not supported");
d18179
 	}