Re: [PATCH] libblkid: Prevent overflow in BeFS

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10 March 2010 08:25, Jeroen Oortwijn <oortwijn@xxxxxxxxx> wrote:
> On 2010-03-09, Jeroen Oortwijn <oortwijn@xxxxxxxxx> wrote:
>> Prevent overflow by casting values to blkid_loff_t before applying
>> block shift.
>
> Now that I think of it, this isn't necessary as the values already get
> coerced into blkid_loff_t.

What I should have done much earlier, is to write a small program [1]
to test this. It appears [2] that the values doesn't get coerced, so
the original patch is still needed. (Unless, of course, there's a flaw
in my test program.)

- Jeroen

[1] the test program:
#include <stdio.h>
#include <inttypes.h>

void print_value(int64_t value) {
	printf("print_value:\t%016" PRIx64 "\n", value);
}

void main() {
	int16_t value = 1, shift = 0x30;
	print_value(value << shift);
	print_value((int64_t)value << shift);
}

[2] the output:
print_value:	0000000000010000
print_value:	0001000000000000
--
To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux