* grub-core/gfxmenu/gui_progress_bar.c (draw_pixmap_bar): Avoid

division by-zero and senseless negative divisions.
This commit is contained in:
Vladimir Serbinenko 2013-11-08 15:38:58 +01:00
parent dd7f792c85
commit bcfa6d72e3
2 changed files with 11 additions and 2 deletions

View file

@ -1,3 +1,8 @@
2013-11-08 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/gfxmenu/gui_progress_bar.c (draw_pixmap_bar): Avoid
division by-zero and senseless negative divisions.
2013-11-08 Vladimir Serbinenko <phcoder@gmail.com>
* configure.ac: Use elf_*_fbsd on kfreebsd.

View file

@ -169,8 +169,12 @@ draw_pixmap_bar (grub_gui_progress_bar_t self)
else
hlheight -= hl_v_pad;
barwidth = (tracklen * (self->value - self->start)
/ (self->end - self->start));
if (self->value <= self->start
|| self->end <= self->start)
barwidth = 0;
else
barwidth = ((unsigned) (tracklen * (self->value - self->start))
/ ((unsigned) (self->end - self->start)));
if (barwidth >= hl_h_pad)
{