* grub-core/video/readers/jpeg.c: Avoid division by zero.

This commit is contained in:
Vladimir Serbinenko 2015-01-20 19:35:49 +01:00
parent 750f4bacd3
commit 4816dcac19
2 changed files with 5 additions and 1 deletions

View file

@ -1,3 +1,7 @@
2015-01-20 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/video/readers/jpeg.c: Avoid sivision by zero.
2015-01-20 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/disk/diskfilter.c: Validate volumes to avoid division

View file

@ -317,7 +317,7 @@ grub_jpeg_decode_sof (struct grub_jpeg_data *data)
{
data->vs = ss & 0xF; /* Vertical sampling. */
data->hs = ss >> 4; /* Horizontal sampling. */
if ((data->vs > 2) || (data->hs > 2))
if ((data->vs > 2) || (data->hs > 2) || (data->vs == 0) || (data->hs == 0))
return grub_error (GRUB_ERR_BAD_FILE_TYPE,
"jpeg: sampling method not supported");
}