This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH 1/2] iconv_prog: Don't slurp whole input at once [BZ #6050]
- From: Rich Felker <dalias at libc dot org>
- To: Benjamin Herr <ben at 0x539 dot de>
- Cc: libc-alpha at sourceware dot org
- Date: Sun, 9 Aug 2015 18:46:18 -0400
- Subject: Re: [PATCH 1/2] iconv_prog: Don't slurp whole input at once [BZ #6050]
- Authentication-results: sourceware.org; auth=none
- References: <1439158464-18443-1-git-send-email-ben at 0x539 dot de> <1439158464-18443-2-git-send-email-ben at 0x539 dot de>
On Mon, Aug 10, 2015 at 12:14:23AM +0200, Benjamin Herr wrote:
> To still support reporting the position of invalid sequences in the
> input, we count consumed input bytes explicitly. As overflow of that
> counter is now possible, we use saturating addition and just mention in
> the error message when (size_t) -1 has been reached.
Why not use uint64_t? Then it's reasonable to assume overflow does not
happen -- it would take something like a century to hit -- and you
don't underreport in the case of huge files that fit in off_t but not
size_t.
Rich