BUG: cause segmentfault when stat() passed invalid parameter

u-uclibc-9coy at aetey.se u-uclibc-9coy at aetey.se
Sat Aug 30 07:45:14 UTC 2014


On Sat, Aug 30, 2014 at 02:00:13PM +0800, Xishi Qiu wrote:
> On 2014/8/30 13:35, Rich Felker wrote:
> > program's memory. So why should passing -1 be safe? This is not a bug
> > in uclibc, just in the caller that's passing an invalid pointer, which
> > is (always) undefined behavior.

> But in x86(use glibc), I tested the program too, it just return an error number,
> not segment fault. I think glibc direct use the user's buf, and syscall return faild.

> Well, do you mean this is not a bug, and need not to change the uclibc?

If the behaviour is undefined by the applicable standard and such use
of the library leads to a crash, it is not a bug, it is wrong usage.

Whether or not a different library behaves differently does not matter.

Calling it with a wrong argument is already wrong usage even when this
does not lead to a crash.

Rune



More information about the uClibc mailing list