lua-users home
lua-l archive

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


Hi Glenn

On Mon, Nov 28, 2005 at 11:06:37PM -0500, Glenn Maynard wrote:
> On Tue, Nov 29, 2005 at 03:33:32AM +0100, Klaus Ripke wrote:
> > not exactly, as it's not a library function, but a syscall
> > (or really some small wrapper for it).
> 
> The point, in case you missed it, was that many C libraries do various
> checking for invalid inputs, and that the degree of "you're on your own"
> is a result of design choices, not the C language.
The point which you obviously missed is that it's not by chance
you came up with a bad example which is not a library function.
Let's see ... sprintf? Hmm ... memcpy? ... no. You're on your own.
The C language does define a lot of library functions and none
checks bad pointers.  So yes, it is a matter of the language.

> > For the kernel crashing is not a design choice (on non-windows systems).
> 
> As I said, the alternative is to segfault the application, not to crash
> the kernel.
Exactly.
That's one reason why syscalls check and libc functions don't.
The other is that library functions can easily check for null
pointers, but there is no way in C to check for a runaway
pointer like a stack overflow.

While C does not prohibit checking the Lua stack,
as was pointed out with regard to the api checks,
this would be rather untypical and still provide
only very limited protection.
Since in C, you're always on your own.


regards