* grub-core/fs/affs.c (grub_affs_read_block): Avoid <= in loop

condition to avoid possibly infinite loops.
	* grub-core/lib/pbkdf2.c (grub_crypto_pbkdf2): Likewise.
	* grub-core/lib/xzembed/xz_dec_bcj.c (bcj_powerpc): Likewise.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2012-02-22 05:22:39 +01:00
parent d46683f97a
commit 84f9d341b0
4 changed files with 12 additions and 5 deletions

View file

@ -1,3 +1,10 @@
2012-02-22 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/fs/affs.c (grub_affs_read_block): Avoid <= in loop
condition to avoid possibly infinite loops.
* grub-core/lib/pbkdf2.c (grub_crypto_pbkdf2): Likewise.
* grub-core/lib/xzembed/xz_dec_bcj.c (bcj_powerpc): Likewise.
2012-02-22 Vladimir Serbinenko <phcoder@gmail.com> 2012-02-22 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/normal/charset.c (bidi_line_wrap): Avoid <= in loop * grub-core/normal/charset.c (bidi_line_wrap): Avoid <= in loop

View file

@ -143,7 +143,7 @@ grub_affs_read_block (grub_fshelp_node_t node, grub_disk_addr_t fileblock)
mod = (grub_uint32_t) fileblock % data->htsize; mod = (grub_uint32_t) fileblock % data->htsize;
/* Find the block that points to the fileblock we are looking up by /* Find the block that points to the fileblock we are looking up by
following the chain until the right table is reached. */ following the chain until the right table is reached. */
for (curblock = node->last_block_cache + 1; curblock <= target; curblock++) for (curblock = node->last_block_cache + 1; curblock < target + 1; curblock++)
{ {
grub_disk_read (data->disk, grub_disk_read (data->disk,
node->block_cache[curblock - 1] + data->blocksize - 1, node->block_cache[curblock - 1] + data->blocksize - 1,

View file

@ -70,13 +70,13 @@ grub_crypto_pbkdf2 (const struct gcry_md_spec *md,
grub_memcpy (tmp, S, Slen); grub_memcpy (tmp, S, Slen);
for (i = 1; i <= l; i++) for (i = 1; i - 1 < l; i++)
{ {
grub_memset (T, 0, hLen); grub_memset (T, 0, hLen);
for (u = 1; u <= c; u++) for (u = 0; u < c; u++)
{ {
if (u == 1) if (u == 0)
{ {
tmp[Slen + 0] = (i & 0xff000000) >> 24; tmp[Slen + 0] = (i & 0xff000000) >> 24;
tmp[Slen + 1] = (i & 0x00ff0000) >> 16; tmp[Slen + 1] = (i & 0x00ff0000) >> 16;

View file

@ -168,7 +168,7 @@ static noinline_for_stack size_t bcj_powerpc(
size_t i; size_t i;
uint32_t instr; uint32_t instr;
for (i = 0; i + 4 <= size; i += 4) { for (i = 0; i + 3 < size; i += 4) {
instr = get_unaligned_be32(buf + i); instr = get_unaligned_be32(buf + i);
if ((instr & 0xFC000003) == 0x48000001) { if ((instr & 0xFC000003) == 0x48000001) {
instr &= 0x03FFFFFC; instr &= 0x03FFFFFC;