bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: source(builtin) and read(2)


From: hooanon05
Subject: Re: source(builtin) and read(2)
Date: Tue, 27 Mar 2007 15:15:18 +0900

Andreas Schwab:
> > When the file size is very large or the filesystem is poor, the read(2)
> > systemcall may not read all of the file. In this case, the return value
> > will be shorter than the requested bytes.
> 
> Even worse, if read returns -1 then this writes beyond array bounds.
> Also, file_size is size_t, but result is only int.

Thank you for your reply.
Although I think these are rare cases, they can be a problem.
- a file larger than MAX_INT.
- read(2) error (returns -1)
  + signal?
  + another process issues chmod(2) and makes the file unreadable,
     between fstat(2) and read(2) in _evalfile().
  + or anything else.
- read(2) succeeds, but the return value is shorter than the requested
  bytes.

Do you have a plan to fix it?

Junjiro Okajima




reply via email to

[Prev in Thread] Current Thread [Next in Thread]