[patch] Fix BZ 19165 -- overflow in fread / fwrite

Alexander Cherepanov ch3root@openwall.com
Mon Oct 26 17:50:00 GMT 2015


On 2015-10-26 06:49, Paul Pluzhnikov wrote:
> Attached patch fixes BZ 19165 by failing fwrite when the byte count is
> impossibly large,

I think this goes against the standard. In such cases fwrite should go 
until an error. A saturated multiplication, as proposed by Florian, is 
probably a good idea.

> and by returning actual count from fread, instead of
> approximation of it.

Thanks, this should eliminate the main concern (please note though that, 
after wrapping, bytes_requested and hence bytes_read may be not evenly 
divisible by size). But I think this is not enough to be standard-compliant.

-- 
Alexander Cherepanov



More information about the Libc-alpha mailing list