[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] read-file: Avoid memory reallocations with seekable files.
From: |
Paul Eggert |
Subject: |
Re: [PATCH] read-file: Avoid memory reallocations with seekable files. |
Date: |
Tue, 03 Aug 2010 13:21:56 -0700 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.11) Gecko/20100713 Thunderbird/3.0.6 |
On 08/03/10 13:05, Giuseppe Scrivano wrote:
> + long pos = ftell (stream);
This isn't reliable on modern 32-bit hosts. Please use
ftello rather than ftell, as ftell is obsolete. You'll
need to alter the module to depend on the ftello module.
> + alloc = st.st_size - pos + 1;
The assignment could overflow, since off_t might be
wider than size_t. This must be checked for. and
errno should be set to ENOMEM if overflow occurs.
Also, the "+ 1" could overflow; this should be checked
for too, preferably by doing + 1 in size_t rather than
off_t (as signed overflow is problematic).
- [PATCH] read-file: Avoid memory reallocations with seekable files., Giuseppe Scrivano, 2010/08/03
- Re: [PATCH] read-file: Avoid memory reallocations with seekable files., Paul Eggert, 2010/08/03
- Re: [PATCH] read-file: Avoid memory reallocations with seekable files., Giuseppe Scrivano, 2010/08/03
- Re: [PATCH] read-file: Avoid memory reallocations with seekable files.,
Paul Eggert <=
- Re: [PATCH] read-file: Avoid memory reallocations with seekable files., Bruno Haible, 2010/08/03
- Re: [PATCH] read-file: Avoid memory reallocations with seekable files., Paul Eggert, 2010/08/03
- Re: [PATCH] read-file: Avoid memory reallocations with seekable files., Giuseppe Scrivano, 2010/08/03
- Re: [PATCH] read-file: Avoid memory reallocations with seekable files., Paul Eggert, 2010/08/03
- Re: [PATCH] read-file: Avoid memory reallocations with seekable files., Giuseppe Scrivano, 2010/08/04
- Re: [PATCH] read-file: Avoid memory reallocations with seekable files., Giuseppe Scrivano, 2010/08/10
- Re: [PATCH] read-file: Avoid memory reallocations with seekable files., Giuseppe Scrivano, 2010/08/18
- Re: [PATCH] read-file: Avoid memory reallocations with seekable files., Eric Blake, 2010/08/24
- Re: ftello license, Bruno Haible, 2010/08/28
- Re: [PATCH] read-file: Avoid memory reallocations with seekable files., Bruno Haible, 2010/08/28