[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: oops? read/write vs type of length parameter
From: |
Jim Meyering |
Subject: |
Re: oops? read/write vs type of length parameter |
Date: |
Mon, 11 Apr 2011 23:54:06 +0200 |
David Kastrup wrote:
> Jim Meyering <address@hidden> writes:
>
>> What about when EMACS_INT is defined to "int"?
>>
>> Someone will inevitably call your write-like function
>> with a length of type size_t -- many existing uses do just that --
>> and by using a signed type, you will have converted their long
>> yet valid (2-4GiB), buffer length, into a negative number.
>
> Resulting in an error or nothing happening. In contrast, if a negative
> number is turned into a long yet valid (2-4GiB) number, it is very
> likely that unintended memory areas will get stomped over.
Since someone mentioned a goal of being able to edit a 2GiB
file, I thought people here would be sensitive to an API policy
that renders that goal unreachable on some systems.
Of course the extra bit doesn't matter when you start with 64,
but starting with only 32, using an unsigned "length" would
avoid that unnecessary limit.
- oops? read/write vs type of length parameter, Jim Meyering, 2011/04/11
- Re: oops? read/write vs type of length parameter, Eli Zaretskii, 2011/04/11
- Re: oops? read/write vs type of length parameter, Jim Meyering, 2011/04/11
- Re: oops? read/write vs type of length parameter, David Kastrup, 2011/04/11
- Re: oops? read/write vs type of length parameter, Eli Zaretskii, 2011/04/11
- Re: oops? read/write vs type of length parameter, Jim Meyering, 2011/04/11
- Re: oops? read/write vs type of length parameter, David Kastrup, 2011/04/11
- Re: oops? read/write vs type of length parameter,
Jim Meyering <=
- Re: oops? read/write vs type of length parameter, Eli Zaretskii, 2011/04/12
- Re: oops? read/write vs type of length parameter, Ted Zlatanov, 2011/04/12
- Re: oops? read/write vs type of length parameter, Eli Zaretskii, 2011/04/12
- Re: oops? read/write vs type of length parameter, Ted Zlatanov, 2011/04/12
- Large file support (was: oops? read/write vs type of length parameter), Eli Zaretskii, 2011/04/12
- Re: oops? read/write vs type of length parameter, Michael Welsh Duggan, 2011/04/14
- Re: oops? read/write vs type of length parameter, Eli Zaretskii, 2011/04/11
Re: oops? read/write vs type of length parameter, Stephen J. Turnbull, 2011/04/11