* grub-core/normal/charset.c (bidi_line_wrap): Avoid <= in loop

condition to avoid possibly infinite loops.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2012-02-22 05:19:11 +01:00
parent c44866b2a6
commit d46683f97a
2 changed files with 8 additions and 3 deletions

View file

@ -1,3 +1,8 @@
2012-02-22 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/normal/charset.c (bidi_line_wrap): Avoid <= in loop
condition to avoid possibly infinite loops.
2012-02-22 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/kern/emu/hostdisk.c (read_device_map): Add missing noreturn

View file

@ -608,7 +608,7 @@ bidi_line_wrap (struct grub_unicode_glyph *visual_out,
{
struct grub_unicode_glyph t;
unsigned i, tl;
for (i = 0; i <= (end - start) / 2; i++)
for (i = 0; i < (end - start) / 2 + 1; i++)
{
t = visual[start + i];
visual[start + i] = visual[end - i];
@ -665,7 +665,7 @@ bidi_line_wrap (struct grub_unicode_glyph *visual_out,
{
unsigned j;
/* FIXME: can be optimized. */
for (j = max_level; j >= min_odd_level; j--)
for (j = max_level; j > min_odd_level - 1; j--)
{
unsigned in = 0;
unsigned i;
@ -734,7 +734,7 @@ bidi_line_wrap (struct grub_unicode_glyph *visual_out,
{
int right_join = 0;
signed i;
for (i = k - 1; i >= (signed) line_start; i--)
for (i = k - 1; i > (signed) line_start - 1; i--)
{
enum grub_join_type join_type = get_join_type (visual[i].base);
if (!(visual[i].attributes