Alec Brown c76a07e15f disk/cryptodisk: Fix unintentional integer overflow
In the function grub_cryptodisk_endecrypt(), a for loop is incrementing the
variable i by (1U << log_sector_size). The variable i is of type grub_size_t
which is a 64-bit unsigned integer on x86_64 architecture. On the other hand, 1U
is a 32-bit unsigned integer. By performing a left shift on a 32-bit value and
assigning it to a 64-bit variable, the 64-bit variable may have incorrect values
in the high 32-bits if the shift has an overflow. To avoid this, we replace 1U
with (grub_size_t)1.

Fixes: CID 307788

Signed-off-by: Alec Brown <alec.r.brown@oracle.com>
Reviewed-by: Darren Kenny <darren.kenny@oracle.com>
Reviewed-by: Patrick Steinhardt <ps@pks.im>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
2022-10-27 15:57:14 +02:00
..
2019-03-25 15:14:52 +01:00
2022-03-14 15:44:45 +01:00
2022-03-14 15:44:45 +01:00
2022-03-14 15:44:45 +01:00
2012-03-26 16:10:40 +02:00
2019-03-25 15:14:52 +01:00
2022-03-14 15:44:45 +01:00
2022-03-14 15:44:45 +01:00