Re: why the usage of gets() is dangerous.
- From: Flash Gordon <spam@xxxxxxxxxxxxxxxxxx>
- Date: Tue, 27 Nov 2007 23:21:53 +0000
CBFalconer wrote, On 27/11/07 20:47:
Flash Gordon wrote:CBFalconer wrote:... snip ...
Somebody procedes to use it again. All sorts of things blow up. The function is ignored, because it passes the tests in theWithout fat pointer and checking you get memory corruption,
original, and it is in a library, and never got recompiled. Don't forget that it has been stamped as VALIDATED in upper case.
I don't want this form of 'checking'.
occasional crashes etc. Are you honestly saying that is better
than having fat pointer causing it to crash? You still have the
problem that the function has been stamped as validated in either
case. Well, with fat pointers and checking you will probably find
it easier to find the problem because it will crash where the
buffer overrun occurs instead of at some random later point.
You have failed to address the latter part of this paragraph where I address why the later debugging would be easier.
YES. Without the faulty checks, nothing will have been so stamped
in the first place. There is no false assurance lying about.
Programmers who would make that assumption would make it with or without fat pointers and bounds checking. Those who bother to attach a debugger and see where it crashes will immediately know where it crashes and why.
The
programmer is used to having to find bugs.
Most programmers also find tools that pinpoint the bugs more accurately by causing the failure to happen earlier to to be useful.
Note that the VALIDATED version may or may not crash when called.
The same is true of any code that invokes undefined behaviour on any implementation. The programmers who assume that because code has passed a limited number of tests prove code correct make that mistake in any case. By your argument we should not do any testing of any libraries or any SW because then it will be VALIDATED and the programmer will assume something else must be wrong when it crashes (admittedly on the rare occasions I have blamed HW faults I have been proved right, but most crashes are not down to HW faults).
You also singularly fail to address the question of why we have memory barriers at all (most modern desktop OSs protect processes from each other etc) or any other safety feature.
--
Flash Gordon
.
- References:
- why the usage of gets() is dangerous.
- From: jayapal
- Re: why the usage of gets() is dangerous.
- From: Paul Hsieh
- Re: why the usage of gets() is dangerous.
- From: Malcolm McLean
- Re: why the usage of gets() is dangerous.
- From: Richard Heathfield
- Re: why the usage of gets() is dangerous.
- From: Malcolm McLean
- Re: why the usage of gets() is dangerous.
- From: CBFalconer
- Re: why the usage of gets() is dangerous.
- From: Keith Thompson
- Re: why the usage of gets() is dangerous.
- From: Tor Rustad
- Re: why the usage of gets() is dangerous.
- From: Richard Bos
- Re: why the usage of gets() is dangerous.
- From: Tor Rustad
- Re: why the usage of gets() is dangerous.
- From: Richard Bos
- Re: why the usage of gets() is dangerous.
- From: CBFalconer
- Re: why the usage of gets() is dangerous.
- From: Flash Gordon
- Re: why the usage of gets() is dangerous.
- From: CBFalconer
- Re: why the usage of gets() is dangerous.
- From: Flash Gordon
- Re: why the usage of gets() is dangerous.
- From: CBFalconer
- Re: why the usage of gets() is dangerous.
- From: $)CHarald van D)&k
- Re: why the usage of gets() is dangerous.
- From: CBFalconer
- Re: why the usage of gets() is dangerous.
- From: Flash Gordon
- Re: why the usage of gets() is dangerous.
- From: CBFalconer
- Re: why the usage of gets() is dangerous.
- From: Flash Gordon
- Re: why the usage of gets() is dangerous.
- From: CBFalconer
- Re: why the usage of gets() is dangerous.
- From: Flash Gordon
- Re: why the usage of gets() is dangerous.
- From: CBFalconer
- why the usage of gets() is dangerous.
- Prev by Date: Re: page 120 K&R
- Next by Date: Re: page 120 K&R
- Previous by thread: Re: why the usage of gets() is dangerous.
- Next by thread: Re: why the usage of gets() is dangerous.
- Index(es):
Relevant Pages
|