Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> You don't need to check against every single value

I said prove for every value, not check every value.

> first is that anything that is expected to be positive should be unsigned integer and secondly, when you parse the string, you fail to check against max integer value.

I wasn't necessarily confining myself to input validation when talking about integer overflow, there are other places and ways it can be caused, and other vulnerabilities in systems than pure invalid input. Maybe I pass perfectly valid input that causes a small bug somewhere deep inside your system to behave weirdly. The point is it's not as simple as "I validate my input and everything's fine".

> Then validate unicode, lol.

That's the point I was making there, you can't just validate ascii these days, and validating unicode's not as trivial as you're making out, plus you now have a unicode parser which may contain any of these problems too.

> Furthermore you design your code not to support unicode

I think your ideas are about two decades out of date here. There's more to the world than ascii and there has been for a long time.

> Based on what, an opinion of some programmers?

Based on where exploits happen and how bad they are.

> But Im not really concerned with distribution of skill within the modern programmers, Im more interested in the assumption that it is hard to write safe C code in comparison to other languages,

Do you not see the inherent contradiction in the way you've stated that? "It doesn't matter if most people can't do it, that doesn't make it difficult"

Plus, you've told us yourself, there are a ton of extra tools and techniques needed to even attempt to make 'safe' code in C compared to other languages where these classes of errors are just impossible by design. Does this not say "harder to make safe" to you?

> and learning that is beyond reach of most people.

The point in the article is that it's quite likely beyond basically everyone, and this is the conclusion a C programmer has come to after 25 years of bitter experience.



Im really starting to hate the internet more and more every day.

You say validating unicode is not trivial, and mention using a parser which can contain bugs.

Or, you can just look at the specification like this one:

https://docs.oracle.com/cd/E18283_01/server.112/e10729/appun...

And easily write your own validator to check against valid byte ranges.

Ill just leave this conversation with "Agree to Disagree".


The point is it's not as trivial as you say, and there's more to safety than pure input validation.

The author's point was that even people who think they're doing it right don't catch everything. If you think you do then I wish you the best of luck, but I also wouldn't want to work on safety-critical systems with you.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: