[PATCH] [pls apply!] Bug #54281 (crash): Konsole crashes on output of certain characters

Oswald Buddenhagen ossi at kde.org
Wed Feb 19 16:16:27 GMT 2003


On Wed, Feb 19, 2003 at 04:26:19PM +0100, Karl Vogel wrote:
> > no. very often return values are not checked (or the function does not
> > return anything, in the first place). thus avoiding a segfault at the
> > library level is equivalent to making the function silently fail.
> 
> Well in this particular case, the function doesn't need to return an
> error.  It can simply return telling the caller that it has done it's
> job. (same like asking to print a string of len 0). 
> 
but (len != 0 & invalid pointer) is clearly an error condition; it would
be simply wrong to ignore it. and the (len == 0 & invalid pointer) case is
covered implicity by the new code.

> > libc functions don't check params, either.
> 
> Are you sure? Try printf("%s", null_ptr)... I'm sure it won't bomb out.
> 
hardly any libc behaves the glibc way.
it's a matter of definition whether it should. printf always creates
some output that will be seen or processed further, so it can't
_silently_ fail. so it is _ok_ to print some representation of it
instead of crashing. and as it is sometimes actually useful to do so,
glibc does. however, it is not _mandated_ to do so. dunno if some newer
standards require this behaviour.

greetings

-- 
Hi! I'm a .signature virus! Copy me into your ~/.signature, please!
--
Chaos, panic, and disorder - my work here is done.




More information about the kde-core-devel mailing list