Re: Cannot compile with _FILE_OFFSET_BITS = 64
On Mon, 31 Dec 2007 14:25:10 +0800, Scott.zhou wrote:
25 if (lseek(fd, 4*1024*1024*1024, SEEK_SET) == -1) { // integer
overflow
In this example, although I explicitly define _FILE_OFFSET_BITS 64, i
get the warning"integer overflow"
4 is an int. 1024 is an int. 1024 is an int. 1024 is an int. When you
multiply ints, you get an int, and the result must be within the range of
an int. Even if that int would later be converted to another type. You
first need to convert the 4 to a wider type, and then start multiplying.
.
Relevant Pages
- Re: size_t overflow
... than overflow. ... question is about size_t arithmetics. ... means all computations involving unsigned char promoted to int, ... After promotion to int, ... (comp.std.c) - Re: dynamic vs. static: the age-old debate
... int addx+y; ... orthogonal to static/dynamic/soft typing. ... $ dynamic-compiler program.source -o program ... will overflow, leaving the "overflow behavior is ... (comp.lang.misc) - Re: size_t overflow
... than overflow. ... question is about size_t arithmetics. ... ..."A computation involving unsigned operands can never overflow, ... means all computations involving unsigned char promoted to int, ... (comp.std.c) - ishopcart cgi 0day and multiple vulnerabilities
... While spending a night auditing I have found 2 buffer overflows and 1 ... there is an overflow in the vGetPostfunction, it does not do any size checking on the inputed data but instead ... void changeport(char *code, int port, int offset); ... (Bugtraq) - Re: dynamic vs. static: the age-old debate
... int addx+y; ... orthogonal to static/dynamic/soft typing. ... $ dynamic-compiler program.source -o program ... will overflow, leaving the "overflow behavior is undefined" ... (comp.lang.misc) |
|