[PATCH 1/2] iconv_prog: Don't slurp whole input at once [BZ #6050]

Rich Felker dalias@libc.org
Sun Aug 9 22:46:00 GMT 2015


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



More information about the Libc-alpha mailing list