]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
term.h: Avoid returining 0-sized terminal as it may lead to division by zero.
authorVladimir Serbinenko <phcoder@gmail.com>
Tue, 20 Jan 2015 16:55:41 +0000 (17:55 +0100)
committerVladimir Serbinenko <phcoder@gmail.com>
Wed, 21 Jan 2015 16:42:13 +0000 (17:42 +0100)
ChangeLog
include/grub/term.h

index c60a231e283d25f58f925d12c435cc2154797287..141aa0660b257eb15b958f4e6539415d3aed27b5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2015-01-20  Vladimir Serbinenko  <phcoder@gmail.com>
+
+       * include/grub/term.h: Avoid returining 0-sized terminal
+       as it may lead to division by zero.
+
 2015-01-20  Vladimir Serbinenko  <phcoder@gmail.com>
 
        * grub-core/fs/zfs.c: Avoid divisions by zero.
index 98c68a5ab9c186b60325a090b7a0a1593903bcda..5ffb38f69aaa8911a66bdc6f417a72666b19e514 100644 (file)
@@ -334,12 +334,12 @@ void grub_term_restore_pos (struct grub_term_coordinate *pos);
 
 static inline unsigned grub_term_width (struct grub_term_output *term)
 {
-  return term->getwh(term).x;
+  return term->getwh(term).x ? : 80;
 }
 
 static inline unsigned grub_term_height (struct grub_term_output *term)
 {
-  return term->getwh(term).y;
+  return term->getwh(term).y ? : 24;
 }
 
 static inline struct grub_term_coordinate