This is the mail archive of the mailing list for the glibc project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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

On Sun, 9 Aug 2015, Rich Felker wrote:

> 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.

off64_t seems logically right for file offsets (with casts to intmax_t for 
printing).  But right now there are several places in iconv_prog.c that 
use non-large-file interfaces for I/O (including trying to mmap the whole 
file into memory without regard to st.st_size - from fstat64 - possibly 
overflowing size_t).  I think large file issues can reasonably be 
considered a separate bug (filed in Bugzilla and fixed separately).

Joseph S. Myers

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]