wrote
(in article
<. com>):
>>> Remember that almost every virus, buffer overflow exploit, core
>>> dump/GPF/etc is basically due to some undefined situation in the ANSI C
>>> standard.
>>
>> Not really. Those that defined early C, and later standard C
>> are not responsible for bad programming.
>
> Bad programming + good programming language does not allow for buffer
> overflow exploits.
For suitably high-level languages that might be true (and
provable). Let us not forget that C is *not* a high-level
language. It's not an accident that it is called high-level
assembler.
I'd love for you to explain to us, by way of example, how you
could guarantee that assembly programmers can not be allowed to
code in a way that allows buffer overflows.
> You still need a bad programming language to
> facilitate the manifestation of these worst case scenarios.
If you wish to argue that low-level languages are 'bad', I will
have to disagree. If you want to argue that too many people
write code in C when their skill level is more appropriate to a
language with more seatbelts, I won't disagree. The trick is
deciding who gets to make the rules.
>> [...] If a programmer has access to the standard (which they
>> do), and they decide to do something which 'invokes undefined
>> behavior', then it is their fault. The standard says do not
>> do that, and they did it anyway.
>
> Ok, this is what I was talking about when I mentioned rose colored
> glasses. If programmers are perfect, then what you are saying is fine,
> because you can expect perfection. But real people are not. And I
> think expectations of perfection in programming is really nonsensical.
/Exactly/ Expecting zero buffer overruns is nonsensical.
> Remember NASA put a priority inversion (a truly nasty bug to deal with)
> in the mars pathfinder. The Arianne rocket blew up because of an
> overflow triggering an interrupt handler that was faulty. You think
> the programmers for these projects were not trying their best to do a
> good job?
No, I do not. I expect things to go wrong, because humans are
not infallible. Especially in something as inherently difficult
as space travel. It's not like you can test it (for real)
before you try it for all the marbles. You can't just hire an
army of monkey to sit in a lab beating on the keyboarrd all day
like an application company.
Anyway, a language so restrictive as to guarantee that nothing
can go wrong will probably never be used for any real-world
project.
> Perfect programmers/programming is a pipedream.
So is the idea of a 'perfect language'.
> There is a
> reason we paint lines on the roads, wear seatbelts, put guardrails on
> stairs and bridges.
Yes. And we require licenses for dangerous activities
elsewhere, but anyone can pick up a compiler and start playing
around.
> The problem of programmer safety can be attacked quite successfully at
> the level of the programming language itself.
It's quite easy to simply make the use of gets() and friends
illegal for your code development. Most of us have already done
so, without a standard body telling us to do it.
> There isn't actually a downside to removing gets() and deprecating
> strtok and strnc??. (Hint: Legacy code uses legacy compilers.)
Hint: Legacy code doesn't have to stay on the original platform.
Even so, anyone dusting off an old program that doesn't go
sifting through looking for the usual suspects is a fool.
I don't have a problem with taking gets() out of modern
compilers, but as you already pointed out, this doesn't
guarantee anything. People can still fire up an old compiler
and use it. I don't see a realistic way for the C standard to
enforce such things.
>>> I consider the ANSI C standard committee basically coauthors
>>> of every one of these problems.
>>
>> I couldn't disagree more. If programmers themselves were held
>> responsible for their mistakes, instead of trying to blame it on
>> loopholes or missing words in a huge document, we would be much
>> better off.
>
> And what if its not the programmer's fault?
It is the fault of the development team, comprised of whoever
that involves for a given project. If the programmer feels like
his boss screwed him over, let him refuse to continue, swear out
an affidavit and have it notarized the bad software was
knowingly shipped, and that you refuse to endorse it.
> What if the programmer is being worked to death?
That would be interesting, because although I have worked way
more than my fair share of 120 hour weeks, I never died, and
never heard of anyone dying. I have heard of a few losing it
and checking themselves into psycho wards, but still. If you
are being overworked, you can either keep doing it, or you can
quit, or you can convince your boss to lighten up. ESPECIALLY
in this case, the C standard folks are not to blame.
> What if he's in a dispute with someone else
> about how something should be done and lost the argument and
> was forced to do things badly?
Try and force me to write something in a way that I know is
wrong. Go ahead, it'll be a short argument, because I will
resign first.
Try and force a brain surgeon to operate on your head with a
chainsaw. good luck.
>> [...] If you could be fined or perhaps even jailed for
>> gross neglicence in software development the way doctors can be
>> today, I suspect the problem would be all but nonexistent.
>
> Ok, that's just vindictive nonsense.
Why? We expect architects, doctors, lawyers, pretty much all
other real 'professions' to meet and typically exceed a higher
standard, and those that do not are punished, fined, or stripped
of their license to practice in the field. Why should
programmers get a pass? Is it because you do not feel it is a
professional position?
We don't let anyone that wants to prescribe medicine, why should
we let anyone that wants to put software up for download which
could compromise system security?
> Programmers are generally not aware of the liability of
> their mistakes.
Then those you refer to must be generally incompetent. Those
that are good certainly are aware, especially when the software
is of a critical nature.
> And mistakes are not completely removable --
Correct. It's also not possible to completely remove medical
malpractice, but it gets punished anyway. It's called a
deterrent.
> and there's a real question as to whether the rate can even be reduced.
As long as there is no risk of failure, it almost certainly will
not be reduced by magic or wishing.
> But if you were to truly enforce such an idea, I believe both C and C++
> as programming languages would instantly disappear.
I highly doubt that. Low-level language programmers would be
the cream of the crop, not 'the lowest bidder' as is the case
today. You would not be hired to work based upon price, but on
skill. Much as I would go look for the most expensive attorney
I could find if I was on trial, I would look for the most highly
skilled programmers I could find to work on a nuclear reactor.
Taking bids and outsourcing to some sweatshop in a jungle
somewhere would not be on the list of options.
> Nobody in their right mind, other than the most irresponsible
> daredevils would program in these langauges if they were held
> liable for their mistakes.
I guess all the professionals in other fields where they are
held up to scrutiny must be irresponsible daredevils too. For
example, there are operations that have very low success rates,
yet there are doctors that specialize in them anyway, despite
the low odds.
If you don't want to take the risk, then go write in visual
whatever#.net and leave it to those that are.
--
Randy Howard (2reply remove FOOBAR)