Slashdot Mirror


The Internet Has a Huge C/C++ Problem and Developers Don't Want to Deal With It (vice.com)

What do Heartbleed, WannaCry, and million dollar iPhone bugs have in common? From a report: One bug affects iPhones, another affects Windows, and the third affects servers running Linux. At first glance these might seem unrelated, but in reality all three were made possible because the software that was being exploited was written in programming languages which allow a category of errors called "memory unsafety." By allowing these types of vulnerabilities, languages such as C and C++ have facilitated a nearly unending stream of critical computer security vulnerabilities for years.

Imagine you had a program with a list of 10 numbers. What should happen if you asked the list for its 11th element? Most of us would say an error of some sort should occur, and in a memory safe programming language (for example, Python or Java) that's what would happen. In a memory unsafe programming language, it'll look at wherever in memory the 11th element would be (if it existed) and try to access it. Sometimes this will result in a crash, but in many cases you get whatever happens to be at that location in memory, even if that portion of memory has nothing to do with our list. This type of vulnerability is called a "buffer-overflow," and it's one of the most common types of memory unsafety vulnerabilities. HeartBleed, which impacted 17 percent of the secure web servers on the internet, was a buffer-overflow exploit, letting you read 60 kilobytes past the end of a list, including passwords and other users' data.

371 of 663 comments (clear)

  1. Developers or Managers? by Terwin · · Score: 5, Insightful

    I expect that there are any number of developers who would be happy to address those issues if their managers would only put enough time into the schedule to do so (and not go-back and demand enough additional features to squeeze it back out of the schedule).

    1. Re:Developers or Managers? by Anonymous Coward · · Score: 1

      You Sir, read my mind. This is one of my daily work grievances, constantly being told to work on feature after feature and only fixing bugs when customers call the CEO. If I had a million mod points you'd be getting all of them.

    2. Re:Developers or Managers? by jythie · · Score: 2

      Unfortunately, this also requires management to be proactive since even if a developer or two are willing to address the shortcomings, if you don't have technical barriers to stop bad behavior you need to use social/process barriers instead. Even saying 'ok, for this project we are using this more secure string/memory/whatever library', you have to keep an eye on everyone so that they use it.

    3. Re:Developers or Managers? by Anonymous Coward · · Score: 5, Insightful

      There is often ZERO ROI for fixing bugs.

      Fixing bugs costs time and money. Clients decide who to go with based on time and money. So, if you spend too much time fixing bugs, your clients all go to your competitors instead.

      You have to cut somewhere, and QA is the juiciest target. Once you win the contract, any bugs that your clients never hit represent money you saved that gave you an advantage over your competitors. Any bugs you clients DO hit but can work around, same deal. Any bugs your clients hit, and that you must fix, represent unexpected costs to you which you can afford because you got the contract. Any bugs you fixed in advance...it's impossible to know if they really needed to be fixed, so they were risks you took that could have cost you the contract.

      If buyers weren't so keen on always going for the lowest bidder, the situation might be different. But as it stands, your business will fail if you spend too much time and money on quality during development.

      So you must release bugs. To succeed.

    4. Re:Developers or Managers? by Anonymous Coward · · Score: 1

      A less pejorative view of management is that software development like all engineering disciplines requires trade-offs. The traditional line is you can have it good, quickly or cheap - pick two (My experience is that you are lucky to get one). We can endlessly debate the wisdom of analyzing security vulnerabilities from a cost versus benefit viewpoint. Perhaps we can agree however that security vulnerabilities in say a media player are not as risky as those is an aircraft flight control system.

    5. Re:Developers or Managers? by Spinlock_1977 · · Score: 4, Insightful

      If you need more time to make your c++ code safe, you're increasing its cost. If the business can't bear the additional cost, you're out of luck. Maybe you're using the wrong tool for the job / setting?

      --
      - The Kessel run is for nerf herders. I can circumnavigate the entire Central Finite Curve in a lot less than 12 parse
    6. Re:Developers or Managers? by bhcompy · · Score: 3, Interesting

      There is often ZERO ROI for fixing bugs.

      Depends on what you're doing. Sounds like you're talking about one off solutions. Regardless, you sound like like some c-level giving a speech to a dev team. We have thousands of customers, and unfixed bugs means cancelled implementation and cancelled maintenance contracts. Fixing bugs costs time and money, but so does developing an application. Maintenance contracts make up the bulk of revenue, and it's very dependable revenue when the product isn't buggy as shit. Keeping those contracts is what keeps your company alive and what keeps your investors happy.

    7. Re:Developers or Managers? by Zmobie · · Score: 5, Insightful

      While there is some truth to your statement (at least in the managers eye's), this is a very common fallacy. My previous industry saw many companies that had that exact mindset and while in the short term it can work, long term it will guarantee the failure of a company. For every bug, hack, and poor design choice the company is taking on technical debt. Up front, yes, the first and most important thing for new companies is securing jobs/contracts. Therefore one can afford and may even require a fair amount of corner cutting early on to accomplish that goal to establish initial footing (as said many times, no project has an infinite timeline and infinite budget).

      If however that mindset is retained once a company is established the technical debt will accumulate and compounds exponentially over time. It also creates an entrenched mindset (that code has worked for years, no way it broke there!) that makes bug hunting and fixing much harder. Once that becomes the case said company gets a rep for having horrible buggy code that is difficult to fix. It then becomes trivial for the more expensive but higher quality products to take everything over. I know because I watched this exact scenario unfold. My previous employer definitely had their fair share of managers with the speed over quality mindset (I actually wrote a post about that yesterday...), but the overall company strategy was to put out higher quality products than competitors even though it was never going to be cheaper. It worked in spades. They were literally getting jobs to fix other companies' fucked up systems before the installs were even complete because the other companies' reputations got so bad. Keeping that code quality definitely required a lot of fighting between the architects/senior developers and management though (this actually contributed to me leaving that company).

      There comes a break point of cost to profitability where that balance shifts to spending too much time/money on perfecting the software. Older game studios were guilty of that a lot I think (see 3D realms and Duke Nukem Forever), but from my point of view the balance has shifted to trying to put out too much stuff now without properly designing, testing, and fixing the underlying framework. It very much seems to be following economic modeling with supply/demand, but I think we are still in a highly volatile time because so much of the technology is new still (first to market is so valuable to businesses). So overall, I disagree that there is zero ROI to bug fixing and preventative measures, but both are undervalued and difficult to measure their ROI.

    8. Re:Developers or Managers? by Kjella · · Score: 1

      Oh, the company loses money on bugs... but does it filter back to the developer/manager who caused the bug? Rarely. Those who get a raise/bonus/promotion are typically those who got the feature/project shipped on time or put out the fire with a dirty hack/band-aid. By the time the bug hits or the system collapses under the maintenance burden those people are usually long gone. Same with the sales people who oversell the product, they get their commission even if it ends up a net loss. In a big public company this goes all the way to the top with the CEO who cares about the stock price next quarter and doesn't mind kicking the can down the road.

      There are exceptions like family run businesses, start-ups, people who take personal ownership of their work, companies with some kind of humanitarian or altruistic purpose and so on. But even within those you have lots of short-term hires and people who are trying to avoid taking the blame for poor work or not actually understanding what they're doing. There's a reason so many people are bad managers, it's actually damn hard to give people the right incentives and make sure good work is rewarded and bad work dealt with. It's like trying to run a puppet show wearing boxing gloves. And I don't just mean dealing with incompetent people, but competent people who aren't getting enough credit for the hair-on-fire situations they're not creating.

      --
      Live today, because you never know what tomorrow brings
    9. Re:Developers or Managers? by postbigbang · · Score: 1

      This is a simplistic view. Many successful breaches are accomplished through multi-part hacks. The media player might be buggy, but that only affects MP3 playing, right? Wrong. It's a vector to root to start mining Monero, or wrapping code into the registry to encrypt swaths of it for ransom.

      If it's plausible to launch a bot army to start at the top and work its way although way down to a Mitre flaw, it'll be done. If it can be monetized through a progressive hack, so be it, as the reward is worth the effort. Quality counts.

      The same faulty logic that creates buffer overflows also puts poisonous metals into dinner plates.

      --
      ---- Teach Peace. It's Cheaper Than War.
    10. Re:Developers or Managers? by jellomizer · · Score: 1

      This is the development problem we tend to have.
      Creating good code, take a long time. If we were to write an application of any real complexity it can take months/years to code. However if you do this by the time you release your program. A dozen competitors have already beaten you to the market with their crap systems, your program looks dated, because all the features are already dated, because your competitors have put in new features already.
      Sure your competition has a program that can be hacked with some effort and may crash every month. But however they are still in business because they can sell the product and pay the fixing problem issue later when they have the capital to afford it.

      --
      If something is so important that you feel the need to post it on the internet... It probably isn't that important.
    11. Re:Developers or Managers? by Tom · · Score: 3, Insightful

      If you need more time to make your c++ code safe, you're increasing its cost. If the business can't bear the additional cost, you're out of luck.

      So your business can't afford the cost of fixing the code, but it can afford the problems that are caused by that faulty code? Are you sure about that or are you just looking for an excuse?

      --
      Assorted stuff I do sometimes: Lemuria.org
    12. Re:Developers or Managers? by nmb3000 · · Score: 1

      There is often ZERO ROI for fixing bugs.

      Maybe after a few CEOs and CTOs go to prison for 5 years for their company's exposing of hundreds of thousands or millions of customer's private information this point of view will change. Suddenly the fallacy of that ZERO ROI will become clear.

      Oh wait, who am I kidding. This is America where the only punishment these execs get is the inflation of their $70m golden parachute as they glide into their next job of screwing people over.

      What happened to Enron should have happened to Equifax. The fact that it didn't tells you just about everything you need to know about the state of things.

      --
      "What do you despise? By this are you truly known." --Princess Irulan, Manual of Muad'Dib
      /)
    13. Re:Developers or Managers? by postbigbang · · Score: 1

      When the target has no rational way of infecting others as a vector, the point is moot. Every desktop, every phone, even some servers have media players. Buffer-overrun-capable? Infection vector. That's what I'm speaking to.

      Lots of junior coders have no idea about parsers, checking memory bounds, and think that moving from py to C is easy and fast. Safety counts.

      --
      ---- Teach Peace. It's Cheaper Than War.
    14. Re: Developers or Managers? by Tom · · Score: 1

      It costs more to produce good C++ than good Python, Java or Kotlin.

      As a blanket statement, I doubt that. It may very well be true in some or many cases, but simply assuming that to be the case is wrong. For example, many years ago I wrote a network simulation code that was pushing the memory limits of my system. It would not have been possible in anything but C where can handle my memory tightly. If I had been forced to write that in something else, I would have needed considerably more expensive hardware, or spent a lot of time writing some kind of virtual memory handling system.

      --
      Assorted stuff I do sometimes: Lemuria.org
    15. Re:Developers or Managers? by Tom · · Score: 1

      Usually the problems caused by the faulty code are infrequent enough that they can afford it.

      Yes, I know. That's the kind of thinking that leads to train accidents and the Windows operating system, but it is indeed very common. But here's the thing: If you properly learn how to write good code, and apply your principles religiously, the TCO is actually in your favour. There are a few software development companies in the world who prove that (google for an article named "they write the right stuff", if I remember correclty). Their downside is slightly longer initial development times, but after that you are good. They even give a lifetime guarantee on their code, that's how confident they are.

      There are always payoffs. Sometimes "too expensive to fix" is true. Sometimes "let's just accept the risk" is the proper decision. More often, however, it is an excuse.

      --
      Assorted stuff I do sometimes: Lemuria.org
    16. Re:Developers or Managers? by Zmobie · · Score: 1

      Actually, I would argue that their day of reckoning will come for the products they have taken this approach on. The main reason it hasn't for their overall business yet in my opinion is no one is directly targeting their main cash cow markets (business productivity software) in a meaningful way. Not only that, their product suite is so diverse it is difficult to knock them off because either it would take a MASSIVE capital investment, a strong consortium of companies, or one hell of a game of whack-a-mole to truly destroy them.

      Internet Explorer is a perfect example of them being arrogant for a long time and thinking they could have a garbage product that people will still use. Now, they've shifted and Edge is a far better product because they knew that was the only way to win back any real market, but they played with fire for too long and lost too much of the market. Now the brand is tarnished in that space and there are way better companies putting out better options.

      I would also cite IBM as a perfect example of short term blinders damaging the company in the long term. Big blue used to be THE tech company and now they are doing good just to keep making a decent profit. Hell, several of their former glory day markets they don't even have anymore because of exactly the issues I described.

    17. Re:Developers or Managers? by Zmobie · · Score: 1

      I actually agree with you on that point, but anyone looking to create long term viability has to fight that tide and typically attempts to (though the true leaders trying to do that are few and the successful ones are even fewer). Unfortunately, to do it the right way, a mix of good long term practices while creating short term profit has to be struck in order to retain the position long enough to really build that solid base. Hence why it is so difficult and why so many fall into the short term gains fallacy.

      Over time though, I would completely agree that it will happen to almost any company simply because eventually enough shareholders get pissed that they buy the snake-oil salesman's pitch and install him to make their short term gains. It is the old adage that trying to defend against so many threats is difficult because they only have to win once, while you have to win a million times all in a row.

  2. It's not the language, you stupid jackwagons... by Penguinisto · · Score: 5, Insightful

    Nobody blames the 18-wheeler itself if the driver is too incompetent to load or drive it properly under most conditions, and nobody needs to go around blaming C/++, either.

    If you're going to play that close to the metal (let alone doing anything further down, like, say, Assembly), at least try to know WTF you're doing, and get help if you're not sure. The more powerful and flexible the tool, the more dangerous (and less tolerant) things can get for the neglectful, the incompetent, and the ignorant.

    --
    Quo usque tandem abutere, Nimbus, patientia nostra?
    1. Re:It's not the language, you stupid jackwagons... by Luthair · · Score: 3, Insightful

      What if the 18-wheeler were designed in such a way that it was very awkward and painful to check mirrors....

    2. Re:It's not the language, you stupid jackwagons... by quintus_horatius · · Score: 2

      If you're going to play that close to the metal (let alone doing anything further down, like, say, Assembly), at least try to know WTF you're doing, and get help if you're not sure. The more powerful and flexible the tool, the more dangerous (and less tolerant) things can get for the neglectful, the incompetent, and the ignorant.

      Aren't you making the article's point for them? IIUC it boils down to: some languages are too difficult for mere mortals to handle, therefore they should be avoided unless you have a really, really good reason.

      There's no licensure for programming so anyone can read up on C and call themselves a C programmer, and most managers aren't qualified enough to tell them they're wrong. In a world such as this, doesn't it become almost necessary to use languages that ensure the programmer can't blow his/her own foot off?

    3. Re:It's not the language, you stupid jackwagons... by Penguinisto · · Score: 1

      Unless that language is, say, HTML, I wish you luck with finding a childproof language. ;)

      --
      Quo usque tandem abutere, Nimbus, patientia nostra?
    4. Re:It's not the language, you stupid jackwagons... by iamgnat · · Score: 4, Insightful

      What if the 18-wheeler were designed in such a way that it was very awkward and painful to check mirrors....

      Then it is still up to the driver to be aware of and manage those limitations.

    5. Re:It's not the language, you stupid jackwagons... by AmiMoJo · · Score: 1

      The best minds have worked on some of this software, e.g. OpenSSL. That didn't prevent things like Heartbleed.

      In engineering we acknowledge that the humans designing and building the thing are flawed, so we test extensively and look for ways to cause failures. We also develop tools that help us find potential failures at the design stage.

      Software engineering should be no exception, but we don't have any equivalent of the crash safety testing we do far cars. Instead we have lots of random people, some of the with good intent and some of them malicious, doing their own testing and looking for flaws.

      Imagine if our security services helped us fix all the flaws they find instead of exploiting them. Imagine if their budget was spend securing us instead of spying on us.

      --
      const int one = 65536; (Silvermoon, Texture.cs)
      SJW, n: "Someone I don't like, and by the way I'm a fuckwit" - AC
    6. Re:It's not the language, you stupid jackwagons... by Checkered+Daemon · · Score: 1

      Yes. If you tell C that you wanna shoot yourself in the foot, C's job is to deliver the bullet to its intended target.

    7. Re:It's not the language, you stupid jackwagons... by RobinH · · Score: 1

      Once technology advances and we have 18-wheelers with out-of-lane warnings and other driver assistance technologies mostly standard everywhere, they will be blaming drivers who refuse to use the new technology.

      --
      "I have never let my schooling interfere with my education." - Mark Twain
    8. Re:It's not the language, you stupid jackwagons... by Anonymous Coward · · Score: 1

      What if the 18-wheeler were designed in such a way that it was very awkward and painful to check mirrors....

      If you know a way to design the 18-wheeler so that it isn't awkward and painful to check the mirrors, and can do it without affecting the speed and load-carrying capacity of the 18 wheeler(1), there's a fortune out there just waiting for you to come pick it up.

      (1) Yeah, that analogy kind of breaks down at this point but I didn't come up with it, so I'll just go with it.

    9. Re:It's not the language, you stupid jackwagons... by Anonymous Coward · · Score: 2, Informative

      When it comes to C/C++ there are pretty much no engineers that manage to avoid these problems. There are millions of engineers who think that these problems only affect other people. They are all deceiving themselves. The vast majority of code written in C/C++ probably should have been written in a safer programming language, which may only have 50% of the performance, would probably only have less than 10% of the critical security bugs.

      Disclaimer: I am a bright, very qualified engineer with 20 years experience writing C for embedded systems on some of the largest network devices made by the biggest networking company in the world. And I dearly wish the world would move on from C/C++ to a programming language that gets the basics right!

    10. Re:It's not the language, you stupid jackwagons... by EvilSS · · Score: 1

      What if the 18-wheeler were designed in such a way that it was very awkward and painful to check mirrors....

      Then the driver should use a different brand 18-wheeler.

      --
      I browse on +1 so AC's need not respond, I won't see it.
    11. Re:It's not the language, you stupid jackwagons... by 110010001000 · · Score: 2

      Do why don't you move on from C/C++? I mean you are bright, very qualified engineer who has identified the problem. Why haven't you fixed it. I already know the answer, so don't bother responding.

    12. Re:It's not the language, you stupid jackwagons... by Charlotte · · Score: 2

      What if the 18-wheeler were designed in such a way that it was very awkward and painful to check mirrors....

      But 18 wheelers *are* awkward, and regularly kill cyclists and pedestrians because they have awkward mirrors that are painful to use. We reacted as a society by requiring special driving licenses and regular health checks (at least in Europe).-

      I think a solution to the problem is to ensure that programmers have access to well known paradigms that can be copy/pasted and by depending on well known libraries, and to use the existing tools that can analyze source code and computer code for known issues.

      I don't think there is a silver bullet for avoiding errors. We're human, after all. Any sufficiently useful language for system programming *will*, by definition, allow you to shoot yourself in the foot.

    13. Re:It's not the language, you stupid jackwagons... by networkBoy · · Score: 4, Informative

      One of the big eye openers I had at a previous gig involved buying a Klockwork license and running it against our codebase. Granted it's still only static analysis, but I think it found close to 20K possible vulnerabilities about 1/3 of which were real (the other 2/3 were after any end user interaction, internal APIs, so that first third would be the interface side). Took a solid 6 months to address 90% of the issues and the other 10% required redesign of architecture to resolve.

      Problem is those tools are *expensive* so most open source projects can't afford them and all but the huge shops don't want to spend the $$.

      --
      whois gawk date unzip strip find touch finger mount join nice man top fsck grep eject more yes exit umount sleep dump
    14. Re:It's not the language, you stupid jackwagons... by networkBoy · · Score: 2

      Unless using pointers, then it will teleport the bullet to another foot you didn't realize was attached to you...

      --
      whois gawk date unzip strip find touch finger mount join nice man top fsck grep eject more yes exit umount sleep dump
    15. Re:It's not the language, you stupid jackwagons... by bob4u2c · · Score: 2

      The best minds have worked on some of this software, e.g. OpenSSL. That didn't prevent things like Heartbleed.

      The best minds did know what they were doing, there was code that zeroed out all the data between calls. The person who picked it up later and saw a huge performance improvement by removing the code that wrote into the buffer twice is what caused the problem. So again, if you use bare to the metal code, know what your doing!

      It bugs me to no end to see someone pick up code someone else wrote and start using it without understanding it. Then when things blow up they blame the code they "got" because it didn't cover every case. Yes there are tools that mitigate this, with either code that checks in real time or code that pre-checks. But the real problem is the coder doesn't really know what is going on and just didn't take the time to figure out if it was going to work for all their cases. And the worst, when it fails instead of trying to understand and fix it, they just want a tool to do that for them. Reality check, you are the tool, do your job and understand what you are doing and stop slapping a bunch of lines together because it looks like it works!

      Sorry for the rant, I have reviewed way too many pull request lately that are just blatantly bad to the point of neglect. The worst so far was code that A didn't fix the issue (didn't even come close), and B introduced a new slew of errors. Its days like this that I wished I hadn't given up sniffing glue.

    16. Re:It's not the language, you stupid jackwagons... by sjames · · Score: 1

      On the other hand, while it is possible to use a circular saw with no guard without hurting yourself and others, the guard is required because too many people were being hurt in practice.

      Meanwhile, there are many regulations surrounding 18-wheelers to make sure they can be and are operated safely.

    17. Re:It's not the language, you stupid jackwagons... by jma05 · · Score: 1

      Tools can be safe or unsafe. To pretend otherwise defies all common sense.

      Design a program with no validation checks in your code and just tell your users to always use the right values. See how far that gets you. Now apply the same logic to your tools.

    18. Re:It's not the language, you stupid jackwagons... by angel'o'sphere · · Score: 2

      and get help if you're not sure.
      The people making those "mistakes" are sure that they don't need help.

      Or do you really think people are such idiots that they stop every 3 lines of code and realize themselves: "Oh! I'm not sure about this! But I just write it this way!" ?

      No, they are much bigger idiots, because they don't realize that they are not sure ... but that is actually not idiotic, or is it?

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    19. Re:It's not the language, you stupid jackwagons... by goose-incarnated · · Score: 4, Informative

      Problem is those tools are *expensive* so most open source projects can't afford them and all but the huge shops don't want to spend the $$.

      Yeah, valgrind isn't all that expensive and can be run on all your tests. Any bug that then gets through vagrinded tests means that the test wasn't testing on or past boundary conditions.

      --
      I'm a minority race. Save your vitriol for white people.
    20. Re:It's not the language, you stupid jackwagons... by hublan · · Score: 1

      The best minds did know what they were doing, there was code that zeroed out all the data between calls. The person who picked it up later and saw a huge performance improvement by removing the code that wrote into the buffer twice is what caused the problem.

      Anyone who argues with me about there being no need to comment their code "because the code is self-explanatory", I specifically use this exact issue as a counter-example of how very wrong they are and how much they can just stand their and bask in their wrongness.

      --
      My spoon is too big.
    21. Re:It's not the language, you stupid jackwagons... by angel'o'sphere · · Score: 1

      So again, if you use bare to the metal code, know what your doing!
      And what exactly has bare to the metal to do with "there was code that zeroed out all the data between calls."?

      So, if I zero our an array in Java, I'm not bare to the metal, but when I do it in assembly, I am?

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    22. Re:It's not the language, you stupid jackwagons... by Wrath0fb0b · · Score: 1

      Nobody blames the 18-wheeler itself if the driver is too incompetent to load or drive it properly under most conditions

      WTF are you talking about? We've long since mandated all kinds of safety features and inspections on 18-wheelers. It's not lawful to load an 18 wheeler above the Federal maximum gross vehicle weight of 80,000lbs, no matter how skilled the driver is. You can't drive without ABS either, even if your driver is so good they don't need it. There are mandatory rest times and maximum duty hours.

      So yeah, you're pedantically right that we don't "blame the 18-wheeler" in a crash, in the sense that inanimate objects are really bad targets of blame since they have no agency. Of course the driver is to blame. But we sure as hell go about figuring out how the next generation of 18 wheelers and associated regulation can reduce either the number of mistakes that drivers make or mitigate the negative consequences of those mistakes.

      Same thing ought to be in software -- we should work towards memory & type safety that reduces the number of mistakes that programmers make and we should improve isolation and hardening so that the negative consequences of those mistakes are contained. Even in C/C++ there are lots of modern safety features being built in, better verifiers like ASAN and UBSAN. And of course the development of Rust/Go/Java/C# and all the other safe languages.

      This isn't really a novel concept. Ever since we decided cars should have crumple zones and safety belts, the road fatalities per mile driven has gone down. Now we have blind spot detection and auto-braking in accidents coming online. In a decade or two we might have self-driving cars. No one is blaming a 1953 Ford Thunderbird for crashing in the rain, but I sure as hell wouldn't drive one in a storm today.

    23. Re:It's not the language, you stupid jackwagons... by ausekilis · · Score: 1

      Folks are also forgetting one of the other recent buzzwords - "Unit Testing".

      Java has Junit and a slew of libraries to support package-time testing of all of your classes - as long as you've taken some time to write 2-3 tests for each function. Packages like this exist in C and C++ too, though I haven't used them directly. I can say that carving out some dev time certainly helps identify those simple logic errors like "I didn't handle a negative index" or "I went past my array size" sorts of error handling.

      As one of my professors said "Java won't give you the gun. C++ will hand it to you, C will help you aim it at your foot".

    24. Re:It's not the language, you stupid jackwagons... by squiggleslash · · Score: 1

      And then you use the same program to shoot your second foot. And then a hacker uses the same program to shoot your "third" foot which happens to be the user's left foot...

      --
      You are not alone. This is not normal. None of this is normal.
    25. Re:It's not the language, you stupid jackwagons... by edtice1559 · · Score: 1

      Those types of tools are generally free if you are developing using a qualifying open source license. Try http://scan.coverity.com./ Yes, I'm affiliated, but I don't get any compensation when people use the service.

    26. Re:It's not the language, you stupid jackwagons... by squiggleslash · · Score: 4, Interesting

      In other words I am very smart.

      Or to put my criticism of what you've written a different way, there's a difference between a programming language including a few features that could, if deliberately misused, cause a problem, and a language that cannot be used by a competent programmer without various types of unintentional problem. And no, handwaving and saying "Ah, but then they're not competent" is not an answer: Dennis Richie could be that programmer.

      You are not that smart. I'm not insulting you, I'm just telling you the truth, and the truth to every C and C++ programmer sitting here smirking about how they can write solid C code. No, you can't. You may be better at it than the VB programmers in the other office, but you're not smart enough to never miscalculate a pointer, never accidentally dereference, or use pointer arithmetic on a pointer that starts at, null. You'll live long enough to put a buffer overflow in a production environment. You'll "learn" from each event, sure, but the worst part is, you will do it again. If you're very lucky, your code will be peer reviewed, and the bugs will get spotted before they go live.

      The difference between a bad C programmer and a good C programmer is not that the latter avoids buffer overflows. It's that the latter is smart enough to know she won't. That she'll eventually fuck it up.

      For what it's worth C is especially awful because, in addition to the basic bounds checks every normal language has, so much of its behavior is "undefined", yet developers are actively encouraged to take advantage of its undefined behavior to achieve useful work.

      C is an artifact of its time, it's a language designed to program a multitasking operating system into a 16 bit minicomputer that had as little as of 8K of RAM. At that time, not only were the overheads of bounds checking a problem, but writing a programming language that supported such features was hard due to the need to ensure the compiler would fit into memory. Somehow, instead of saying "Wow, Unix has some great ideas, let's incorporate the better ones into the next generation of operating systems", we're stuck with Unix and its clones as the major computing standard at the moment (well, together with Windows which, because of the popularity of C in the 1980s at Microsoft, ended up with the same faults and then some.)

      Unix has its flaws even if you dump the code and rewrite it to work in exactly the same way but using (gag!) Modula 2 or some other "safe" language. But it's worse because you can't trust it. You have thousands of C programs installed. And some of them were written by people like you, people who think that they can program in C without making a mistake.

      --
      You are not alone. This is not normal. None of this is normal.
    27. Re:It's not the language, you stupid jackwagons... by Luthair · · Score: 2

      But 18 wheelers *are* awkward, and regularly kill cyclists and pedestrians because they have awkward mirrors that are painful to use. We reacted as a society by requiring special driving licenses and regular health checks (at least in Europe).-

      This statement proves my point and shows the flaw in the grandparents argument. Despite these issues being known and attempts to place a band-aid on the problem it still happens. At a certain point you need to fix the tool not the user.

    28. Re:It's not the language, you stupid jackwagons... by Uecker · · Score: 1

      I am not sure what you mean, but the heartbleed bug was in the initial version of the heart beat feature. Maybe you are thinking of the Debian OpenSSL PRNG bug? This bug was introduced when shutting up valgrind warning not to improve performance though.

    29. Re:It's not the language, you stupid jackwagons... by UnknownSoldier · · Score: 1

      Code tells you HOW,
      Comments tell you WHY.

    30. Re:It's not the language, you stupid jackwagons... by gweihir · · Score: 1

      Indeed. And it is not like applications written in memory-safe languages are more secure in reality. The problem is incompetent developers, plain and simple. In a memory-safe language, they just screw up something else with pretty much the same result.

      --
      Most ACs are not even worth the keystrokes to insult them. Be generically insulted by this and ignored otherwise.
    31. Re:It's not the language, you stupid jackwagons... by Uecker · · Score: 2

      For what it's worth C is especially awful because, in addition to the basic bounds checks every normal language has, so much of its behavior is "undefined", yet developers are actively encouraged to take advantage of its undefined behavior to achieve useful work.

      No. "Undefined" nowadays essentially means that it is illegal what you are doing and nobody is encouraged to take advantage of it. It depends on the compiler what happens: Often the compiler assumes that "undefined behaviour" cannot happen and it can use this fact for optimization. But alternatively it could also add a run-time check, e.g. for bounds checking.

    32. Re:It's not the language, you stupid jackwagons... by farble1670 · · Score: 1

      If you're going to play that close to the metal (let alone doing anything further down, like, say, Assembly), at least try to know WTF you're doing, and get help if you're not sure.

      If you are suggesting the solution is to just "git gud" you do not write code.

      Bugs will happen, no matter how seasoned is the developer. The complexity of software makes it hard if not impossible to find find and test for all cases. Heartbleed existed for 6 years before it was discovered. One person wrote the code, but how many people viewed / reviewed the code, how many people tested it, and how many had it in production before it was discovered?

      The issue at hand here is what happens when a bug occurs. Do you get undefined behavior or does the program crash? The latter is much preferred obviously.

    33. Re:It's not the language, you stupid jackwagons... by gweihir · · Score: 1

      You can write insecure web-apps in a functional language just fine. That is if it can handle the interaction.

      --
      Most ACs are not even worth the keystrokes to insult them. Be generically insulted by this and ignored otherwise.
    34. Re:It's not the language, you stupid jackwagons... by SuricouRaven · · Score: 3, Informative

      Perl was *made* for text processing. Though it does make handling binary data a bit awkward.

    35. Re:It's not the language, you stupid jackwagons... by phantomfive · · Score: 1

      You are not that smart. I'm not insulting you, I'm just telling you the truth, and the truth to every C and C++ programmer sitting here smirking about how they can write solid C code. No, you can't.

      It's not about smartness, it's about knowledge. Knowing what you are doing. I worked at a company that was a mix of C and Javascript programmers, and monitored memory leaks in production. The C code had zero memory leaks, and the Javascript code bloated quickly over time until the product was unusable in the browser.

      How did the C programmers avoid memory leaks? It wasn't because of their skill: many were recent graduates right out of college. The system was set up correctly because one of the lead programmers knew what to do (basically he built a memory library that set things up to easily avoid memory leaks).

      It's possible to write secure C, but people don't do it because they don't know how.

      --
      "First they came for the slanderers and i said nothing."
    36. Re:It's not the language, you stupid jackwagons... by PaulRivers10 · · Score: 1

      Nobody blames the 18-wheeler itself if the driver is too incompetent to load or drive it properly under most conditions, and nobody needs to go around blaming C/++, either.

      That's one of those odd arguing tactics where you pick something that is incredibly heavily blamed/regulated and claim it isn't. Laws literally ban overly large, difficult, or heavy 18 wheelers. If there is a crash both driver and the company who hired the truck and driver are quite often blamed. Mirrors, equipment, maintenance, safety checks, etc on the vehicle are all part of federal and state laws and highly regulated. A flamethrower is simply a more dangerous way to cook a chicken sandwhich than a stove is.

    37. Re:It's not the language, you stupid jackwagons... by Waccoon · · Score: 1

      Buy your 18-wheeler from a different vendor. Sounds like a problem with the driver assists and bling, not the platform.

    38. Re:It's not the language, you stupid jackwagons... by Raenex · · Score: 1

      (basically he built a memory library that set things up to easily avoid memory leaks).

      So he reinvented the wheel to get around C problems. Of course, that only "solves" one of the least harmful memory issues in C. Memory leaks will cause you to run out of memory, but they don't corrupt it like buffer overflows, use after free, etc., will.

    39. Re:It's not the language, you stupid jackwagons... by iamgnat · · Score: 1

      When it comes to C/C++ there are pretty much no engineers that manage to avoid these problems. There are millions of engineers who think that these problems only affect other people. They are all deceiving themselves.

      While this is true, this is true in any language as is evidenced by the continued life of SQL-I attack vectors because most "developers" simply google a problem and take the first answer. That is not a fault of the language though, it's the idiot behind the keyboard.

      The vast majority of code written in C/C++ probably should have been written in a safer programming language

      Really? What safer options do you have in embedded programming? What safer alternatives are there for kernel and driver development? Outside of those areas there are really only a few niches that seem to be actively selecting C/C++ (e.g. where "50% of the performance" is unacceptable) other than to support legacy code/systems.

      Beyond that, just what do you think the underpinnings of most of the "safer" languages is written in? While it's not nearly as big as it used to be in terms of visibility, C/C++ are still at the core of making things work. I think most of us that have spent any time with the languages would love to see them replaced with something better, but so far nothing has stepped up to the challenge in a meaningful manner.

    40. Re:It's not the language, you stupid jackwagons... by iamgnat · · Score: 1

      This is delightfully naive. Design faults in one part of a system must be compensated for by all other actors in the system, not just the immediate operator. If 18-wheelers started having a big usability issue, then truckers, truck makers, trucking line operators, unions, state agencies, politicians, and the DOT may all jump in (depending on severity) to get the problem fixed.

      Not at all. If such bodies exist around a product there is a significant time lag involved in identifying the problem, arguing about who is to blame, arguing about corrective action, designing the solution, implementing it, and finally getting it rolled out. Some times this is months and others it is years (or never). In the meantime if you continue to operate the "defective" system then it is entirely up to you to make sure that you do so in a safe manner. Just look to the GM ignition switch fiasco or Tata airbags to see how "quickly" those agencies get something resolved...

      There are all types of regulations, laws, and safety equipment around driving a car, but if you pick up someone's junker that doesn't have working airbags then the responsibility is 100% on you as to how to deal with it (drive anyway knowing that if an accident happens you are at a higher risk for injury/death, go get the parts (in another car) and fix it, tow it somewhere to get it fixed, etc..). There is no law that prevents you driving it and there is nothing built into the car to prevent it's use. It's all you.

    41. Re:It's not the language, you stupid jackwagons... by strikethree · · Score: 1

      You have done an excellent job of explaining issues with C and C++.

      You have explained that memory safe languages can mitigate some of those issues.

      You have not shown that memory safe languages are preferable, or better, than C and/or C++. Just because a language solves one problem, that does not mean it does not introduce other, different problems. Rather like jumping from the frying pan and into the fire.

      TL;DR, Yes. There are potential issues with C/C++. Solving just those issues does not inherently make another language more desirable.

      --
      "Someone needs to talk to the tree of liberty about its ghoulish drinking problem." by ohnocitizen
  3. With great power comes great responsibility! by Rick+Schumann · · Score: 4, Insightful

    Guess what? As clever as Python and Java are, you can't effectively write an entire operating system in them, or a high-performance driver like a graphics card driver in them. You could try, but the result would be bloated and slow and effectively useless. So we have compiler languages like C/C++ that require you to actually be a competent programmer who can write code with proper error checking and error handling. I'm not saying that when you have an entire platoon of programmers all working on parts of the same project (vis-a-vis graphics card driver or OS) that there aren't going to be bugs that crop up, but slapping training wheels onto them isn't necessarily the solution to the problem either.

    Note also another 'language' that would have this same problem, and for which there is no substitute for in the highest-performance applications: assembly language. Yes, Virginia, we still use assembly language in some places, so far as I know. Then you really have to know what you're doing.

    Maybe the solution to this problem is to educate and train our programmers more thoroughly and carefully.

    1. Re:With great power comes great responsibility! by AmiMoJo · · Score: 5, Insightful

      Flaws in drivers used to be attractive to malicious actors because drivers ran in the kernel and had immense power. Modern operating systems limit drivers so that the damage they can do is greatly reduced. Also helps with stability because your sound card driver crashing won't bring the whole machine down any more.

      That's the key to security. Assume stuff will have bugs, isolate it, sandbox it, put layers of security in and limit the damage. A bug in the network stack should at worst crash the network stack, which while annoying is far less critical than being able to read parts of kernel or process memory.

      --
      const int one = 65536; (Silvermoon, Texture.cs)
      SJW, n: "Someone I don't like, and by the way I'm a fuckwit" - AC
    2. Re:With great power comes great responsibility! by jythie · · Score: 2

      I think the solution would be closer to 'right tool for the job'. The problem with C/C++ is you have to work to make it safe, as opposed to something like Python where you have to work to make it unsafe, at least in terms of the type of vulnerabilities the OP is addressing. I think a lot of the problem comes from C/C++ being used too often for too many types of problems, problems that do not really gain from the amount of control the languages give you but do suffer from needing to take thoughtful explicit steps to make it safe.

    3. Re:With great power comes great responsibility! by Anonymous Coward · · Score: 4, Insightful

      Assuming a halfway decent compiler, you could write a graphics driver or a kernel in Rust with little or no performance penalty versus C. You could probably write one in Go. Many have been written in Ada. And I could name many other languages along the same lines. Those are languages that compile down to machine code and can do static allocation and/or explicit dynamic memory management... with static compile-time type checking and pointer and array safety guaranteed.

      Yes, array bounds checks are expensive. However, not that many lines of code actually need to index arrays directly, and especially not with random access as opposed to traversing the whole thing (which can usually be sped up). There are even fewer such cases where the code is on the performance path AND your compiler can't prove what you're doing is safe. And arbitrary pointer arithmetic is still less often needed.

      If you have to do truly unsafe stuff all the time to get performance, you've misdesigned your language, your libraries, your RTS, and/or your data structures.

      In a sanely designed system, on the rare occasions when you really do need to do something unsafe, you either break into another language (yes, even assembly and maybe even C), or you use some specialized construct that explicitly marks the code as unsafe. But maybe one line of code in 100, or even one line in 1000, uses anything potentially dangerous, and you and your tools can easily identify which code it is.

      What you do not do is what C does: have every single line of code potentially full of pointer arithmetic, with the very most common idioms being completely unsafe, not even a concept of a distinction between safe and unsafe constructs, and no protection whatsoever against out of bounds access.

      C's whole approach to pointers, unions, arrays, and most structures is obsolete and basically broken.

      No, it is not necessary to have that kind of power on every line in your main implementation language.

      Maybe the solution to this problem is to educate and train our programmers more thoroughly and carefully.

      Hi, there. I've been programming since about 45 years ago, or over 35 if you only count truly professional coding in institutional settings. I haven't always been pounding out code day in and day out during all that time, but I've written many thousands of lines of code in C and assembly as well as various other languages. I have written drivers from scratch for more than one kernel. I have coded on bare metal with no OS at all.

      I have coded without a safety net. I coded back when compilers in general were really dumb. They rarely noticed when you'd done something obviously idiotic. They never told you you hadn't checked something you should. They almost never optimized out a check you didn't need to make. They offered you few ways to give them any hints about what you were really trying to do. Sometimes they forced you to do dangerous things just because they generated such bad code.

      I have a real CS degree from a top university. I don't tend to take a lot of industry training, because it's mostly crap, but I've been around enough to take a fair amount of it in absolute terms.

      I know all the defensive coding tricks. I seem to have a relatively low bug rate compared to many other coders.

      I think I qualify as an "educated programmer".

      One of the things I've learned from that education and experience is not to expose myself to risks I don't need to take.

      For example, if asked to write a large security-critical system, I'm not wet enough behind the ears to actively choose to stick it all in a single address space and then write the bulk of it in C.

      That's because my education and training have taught me that all humans, including but not limited to myself, are unreliable components.

      It's stupid to put faith in them when you don't have to.

      Python, by the way, is not "clever". It has

    4. Re:With great power comes great responsibility! by Rick+Schumann · · Score: 1

      My personal opinion of Python: Since I learned how to code in C and assembler, Python gives me an ice-cream headache with all it's weirdnesses. It's a Heinz-57 of programming languages, taking from all over the place, and some of the syntax just made me want to throw things once I discovered them.

    5. Re:With great power comes great responsibility! by thegarbz · · Score: 1

      you can't effectively write an entire operating system in them

      An entire operating system? No. You can however write most of an operating system in them leaving the use of C and C++ for only the situations where low level hardware access is necessary. Citation: The worlds most popular OS running on a Linux kernel.

    6. Re:With great power comes great responsibility! by Hizonner · · Score: 1, Insightful

      Then how come every single project's C style guide requires you to indent it just so?

      What's really broken is having the humans relying on whitespace (which they DO), and the compiler relying on punctuation.

    7. Re:With great power comes great responsibility! by sfcat · · Score: 1

      ANY language where whitespace has more significance than separating words is fundamentally broken.

      Mod up!!!

      --
      "Those that start by burning books, will end by burning men."
    8. Re:With great power comes great responsibility! by angel'o'sphere · · Score: 2

      You can write an OS in any language. There are actually a few OSes written in Java ...

      So we have compiler languages like C/C++ that require you to actually be a competent programmer who can write code with proper error checking and error handling.
      Error checking etc. is the same in any language ... you know nothing about programming.

      assembly language. Yes, Virginia, we still use assembly language in some places, so far as I know. Then you really have to know what you're doing.
      You need to know what you are doing in any language. Assembly is not particular difficult ... it is only extremely ineffective in programming in it.

      Guess what: in a day you write perhaps 100 lines of code. And the language you use does not change that amount of lines much. So: the higher level of abstraction your language offers, the more "business code" you are actually achieving with those 100 lines.

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    9. Re:With great power comes great responsibility! by Sigma+7 · · Score: 2

      Just make the fucking C compiler give you an error when you go out of bounds.

      There's at least one platform where you need to use a pointer to a specific point in memory. Perhaps some old programmer may remember "char far *video_buffer = 0xA000:0000" from Borland C when doing basic graphics. Here, the compiler can't tell if you're going out of bounds, since it doesn't automatically know what you're doing.

      Same applies to modern C. There may be the odd situation where you access memory directly (e.g. some memory mapped file, shared memory between two processes, etc.) and the compiler can't tell if you're going out of bounds for what you're specifically you're doing because there's no way of telling if something is in-bounds for the whole region but out of bounds just for one item.

      Regardless of whether or not C has bounds checking, all programming languages are all implemented in a language that has no inherent bounds checking (assembly language, machine language or generic VM code).

    10. Re:With great power comes great responsibility! by Rick+Schumann · · Score: 1

      Yeah, that was one of the weirdnesses that made my eyes roll at first.

    11. Re:With great power comes great responsibility! by Ichijo · · Score: 2
      --
      Any sufficiently unpopular but cohesive argument is indistinguishable from trolling.
    12. Re:With great power comes great responsibility! by HornWumpus · · Score: 1

      In the early days of microcomputers OSs came in three grades.

      1. An OS.
      2. An OS that uses basic as it's command interpreter.
      3. An OS written in Basic.

      --
      John McAfee 'It was like that time I hired that Bangkok prostitute; to do my taxes, while I fucked my accountant'
    13. Re:With great power comes great responsibility! by Tyler+Durden · · Score: 1

      You can write an OS in any language. There are actually a few OSes written in Java ...

      Fantastic. And how many of those are practical enough that you can use them for your serious day-to-day work? Little if any, I bet. And there's a reason for that.

      I seriously doubt you could right one in pure Java though. Especially in dynamic memory allocation code, which requires assigning and returning an explicit address at some point. Sure, even C kernels need to employ another language (assembly) from time-to-time. But not that much.

      --
      Happy people make bad consumers.
    14. Re:With great power comes great responsibility! by gweihir · · Score: 1

      In addition, it is pretty much as easy to make web-applications effectively as insecure in a memory-safe language. Just screw up permission checking, for example. Otherwise we would not see the flood of vulnerabilities in things written not in C or C++.

      The whole article addresses the wrong problem.

      --
      Most ACs are not even worth the keystrokes to insult them. Be generically insulted by this and ignored otherwise.
    15. Re:With great power comes great responsibility! by AndrewFlagg · · Score: 1

      well said. bravo. now could some of the VPs outside of technology and engineering that cry all the time, and who sit on high, should know this, oh by the way their password is GOD or PASSWORD and you don't need to hack a buffer overflow to know that. ahem.. i digress again. C/C++ is just fine. just have a great test development team that 1/2 is allowed to read the code and the other 1/2 don't... just white and black box in a closed network environment please..

    16. Re:With great power comes great responsibility! by jittles · · Score: 1

      Guess what? As clever as Python and Java are, you can't effectively write an entire operating system in them, or a high-performance driver like a graphics card driver in them. You could try, but the result would be bloated and slow and effectively useless. So we have compiler languages like C/C++ that require you to actually be a competent programmer who can write code with proper error checking and error handling. I'm not saying that when you have an entire platoon of programmers all working on parts of the same project (vis-a-vis graphics card driver or OS) that there aren't going to be bugs that crop up, but slapping training wheels onto them isn't necessarily the solution to the problem either. Note also another 'language' that would have this same problem, and for which there is no substitute for in the highest-performance applications: assembly language. Yes, Virginia, we still use assembly language in some places, so far as I know. Then you really have to know what you're doing. Maybe the solution to this problem is to educate and train our programmers more thoroughly and carefully.

      I can confirm that we still write certain things in ASM for Intel, AMD, and ARM products at my company. Most is written in C because it is ‘fast enough’. But sometimes even C can be too slow and, in certain applications at work, too high level to use effectively.

    17. Re:With great power comes great responsibility! by Tyler+Durden · · Score: 1

      Right. But the point is there are huge swaths of code that can be written in something more low-level like C (without dipping into assembly) that cannot be done in Java. And yeah, spinlock implementations require assembly.

      --
      Happy people make bad consumers.
    18. Re:With great power comes great responsibility! by Ichijo · · Score: 1

      it's literally impossible to see the difference.

      Does your editor not have a "View White Space" setting?

      The tab key is for telling your editor to auto-indent (using spaces).

      How many spaces: zero, one, or infinity?

      --
      Any sufficiently unpopular but cohesive argument is indistinguishable from trolling.
    19. Re:With great power comes great responsibility! by 110010001000 · · Score: 1

      "you could write a graphics driver or a kernel in Rust with little or no performance penalty versus C. You could probably write one in Go."

      No you couldn't and have it perform acceptably. That is why people don't do it. Amazingly, there are many people that actually know what they are doing, but don't do what you say. That is how you know you are wrong (even though you clearly have a high opinion of yourself).

    20. Re:With great power comes great responsibility! by RhettLivingston · · Score: 1

      I have written an operating system and drivers in Ada that ran in a very complex embedded system that had a mix of over a hundred CPUs of different types. Elsewhere in that same system I also wrote an operating system with C. The interesting thing is that the one written in Ada was running on a CPU with 8 times the speed and 4 times the memory of the one written in C, but the one written in C outran it dramatically. Ada's performance sucks.

    21. Re:With great power comes great responsibility! by angel'o'sphere · · Score: 1

      And yeah, spinlock implementations require assembly.
      No they don't. Why would they? Every language that compiles to machine code can be used. A no brainer ...

      You can hate the Java Eco System as much as you want: it is a language, and a vm and a set of libraries. If it lacks something you need for a specific reason, you always can upgrade the vm or the libraries or the compiler of the language.

      There is no fundamental difference to C or C++ or assembly ...

      Your misinformation comes from a simple thing: you think for some reason Java/C# programmers are dummies. And because you don't use those languages you are superior, and hence the language you use is superior and hence you "imagine" stupid non existing limitations of the stuff you hate.

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    22. Re:With great power comes great responsibility! by Tyler+Durden · · Score: 1

      No they don't. Why would they? Every language that compiles to machine code can be used. A no brainer ...

      Because you need a single atomic operation can both read from and write to the same memory location in one shot. That requires assembly language instruction(s) to pull off. But if you have an example of how it can be done in Java or some other high level language, feel free to post the code here.

      You can hate the Java Eco System as much as you want: it is a language, and a vm and a set of libraries. If it lacks something you need for a specific reason, you always can upgrade the vm or the libraries or the compiler of the language.

      The question is, how much do you have to change the language to be a preferable choice for creating a kernel? It's extremely likely that by the time you make enough changes to Java for that, it will be something other than Java.

      Have tried any real (not simulated) OS kernel development? This guy seems like he might know a thing or two about it. I do not do kernel development professionally myself. But in my job the language I use more often than any other is, in fact, Java.

      --
      Happy people make bad consumers.
    23. Re:With great power comes great responsibility! by angel'o'sphere · · Score: 1

      Because you need a single atomic operation can both read from and write to the same memory location in one shot.
      Ah ha .... and a compiler can not generate that opcode ?

      Hm ... I must have missed something in the last years.

      The question is, how much do you have to change the language to be a preferable choice for creating a kernel?
      Ha ha.

      How many kernels are multithreaded aka reentrant?

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    24. Re:With great power comes great responsibility! by angel'o'sphere · · Score: 1

      Well,
      I used 1 and 2 ... but not 3 :D

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    25. Re:With great power comes great responsibility! by Tyler+Durden · · Score: 1

      Ah ha .... and a compiler can not generate that opcode ?

      Not as a part of any general code syntax you can't. It's a specialized instruction. One that is different from processor to processor. (In x86 they usually use an xchg instruction). There are a lot of OS kernel specific spots where you'd need something like that.

      But sure, you could change the Java compiler so that when it sees some keyword or method it will add those opcodes once compiled. But those instructions have to be added to the compiler first. Written if you will. Written in assembly. Which is what I'm saying. And if you think that doesn't count then by that reasoning someone could code thousands of lines of assembly manually into the compiler, called upon by mock static methods and claim, "See, no assembly was required. Just the Java compiler. Success!" LOL

      How many kernels are multithreaded aka reentrant?

      All varieties of Unix kernels are. Possibly Windows as well. So there's a possibility that most OS kernels used today are reentrant. But even if the kernel itself is not, you'll still have to implement the locking mechanisms so that any processes or threads it runs can share resources safely.

      I'm going to ask you again. Have you written any kernel code that ran directly on hardware without an emulator? By that I mean the only code that is run on the machine other than the code you compiled yourself is a handful of BIOS calls for some set up needed upon boot-up. I have, and done plenty of Java coding as well. One mistake that people make when they are only familiar with Java and an overview of OS internals is all the things Java does for them that they take for granted.

      Look it's fine to have a language when you can have a JVM, a garbage collector that ultimately relies on system calls and libraries to complete the freeing of resources, synchronization primitives and the like. You get used to them enough and you might think they are covered by just some simple, unimportant details that are like any other programming issue you've used the language to solve before. But when the purpose of the system you are writing is to implement those very same functions that you have been taking for granted, it's a very different thing. A thing for which Java is a very shitty tool.

      --
      Happy people make bad consumers.
    26. Re:With great power comes great responsibility! by angel'o'sphere · · Score: 1

      But sure, you could change the Java compiler so that when it sees some keyword or method it will add those opcodes once compiled.
      The JVM/Java compiler has this since ages. They use "marker data types" as AtomicInteger and AtomicLong etc.

      All varieties of Unix kernels are.
      That is interesting, I did not know we made so much progress.

      Have you written any kernel code that ran directly on hardware without an emulator?
      Yes, about 30 years ago.

      A thing for which Java is a very shitty tool.
      Again: if you have a compiler that generates native code, there is no difference between C, Java or Pascal. While C lacks the "keyword" to indicate that a variable access should be atomic, it has most certainly #pragma directives for it.

      a garbage collector that ultimately relies on system calls
      A GC (especially in Java) does not need system calls. It is basically only a glorified malloc/free substitute. Java does not even use sbrk() ... the maximum memory is fixed at start up time.

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
  4. And the news about buffer overflows is... by enriquevagu · · Score: 4, Funny

    that they exist?

    1. Re:And the news about buffer overflows is... by Anonymous Coward · · Score: 1

      I think it's that we're calling them "unsafety".

  5. This is news in 2018? by Anonymous Coward · · Score: 2, Insightful

    Unless you just woke up from a coma from 1993, you should have known about unsafe memory practices in 2018.

    Switching to a new language like Rust might help this problem, but it ignores the enormous cost of re-writing software, library compatibility, retraining, etc. The security of the language is just one aspect of selecting the language, not the only one.

    And it's not as if you get a magic security shield just because you chose a memory safe language. There's plenty of other security problems that are either language agnostic, or made worse by language choice. Memory safety is just one aspect of security.

    1. Re:This is news in 2018? by Anonymous Coward · · Score: 1

      C also does not have a code of conduct like Rust does, so there are potentially more available developers.

    2. Re:This is news in 2018? by jythie · · Score: 1

      This wasn't even news in the 1970s. This is a very old and very well understood problem, with solutions that are nearly as old.

    3. Re:This is news in 2018? by thrig · · Score: 1

      Rust you say... https://github.com/jwilm/alacr... https://nvd.nist.gov/vuln/deta... off by ones, and where were the unit tests? progress in coding... as for how one regards all the "have you heard the good word of Rust" evangelism and that cod of conduct, well now that's opinion territory

    4. Re:This is news in 2018? by jma05 · · Score: 1

      Experts: You need to wear a helmet on a bike. They can reduce fatalities.
      You: Here is a guy who died even with a helmet. This is opinion territory.

  6. Re: No problems with my first post algorithm by Penguinisto · · Score: 4, Funny

    Shows how optimized your code is. Didnt even make first post.

    He forgot to check clock()

    --
    Quo usque tandem abutere, Nimbus, patientia nostra?
  7. Too much freedom by mi · · Score: 1

    What TFA is arguing for is a layer of verifications performed by the program's execution environment, checking its every move.

    The checks aren't free — they make everything a little slower and/or consuming more resources (such as RAM). Whether that slow-down is worth the increased safety may be subject to debate...

    But the parallels with human lives are inescapable. The checks argued for are no different from the much-denounced police practices, such as "stop-and-frisk", tracking citizens' identifications, and movements — and the arguments for and against them are much the same...

    --
    In Soviet Washington the swamp drains you.
    1. Re:Too much freedom by alvinrod · · Score: 3, Interesting

      Sure you can draw parallels, but I don't recall my computer processes having constitutional rights, so excuse me if I don't feel quite the same emotional stir over bounds checking as I might when the police state does something untoward.

    2. Re:Too much freedom by mi · · Score: 2

      I don't recall my computer processes having constitutional rights

      There is nothing in the Constitution against tracking your car's movements on a public road either.

      But I'm not talking about rights per se, but about whether or not such surveillance make sense at all. That is, whether the costs (the time and money, leaving the morals aside) of it justify the benefits.

      --
      In Soviet Washington the swamp drains you.
    3. Re:Too much freedom by djinn6 · · Score: 1

      A program exists for the programmer's sake, but people do not exist for the government's sake.

  8. Quote From The Article by deKernel · · Score: 5, Insightful

    "Finally, we can shift the culture around security within software engineering. When I first learned C++ in college, it was expected that sometimes your program would crash."

    A quote from the article...WTF school is teaching this kind of crap. It would appear that the issue mainly resolves around the teaching practices and not so much the language.

    1. Re:Quote From The Article by Anonymous Coward · · Score: 1

      School? Companies are hiring people out of high school based on them showing apps they've written and don't want them "contaminated by 4 years of learning old things (by the time it makes it into textbooks, and this is the gist of an actual statement from a leading developer) when we cn use their skills to do new things."

    2. Re:Quote From The Article by Dog-Cow · · Score: 1

      If you're still learning, I'd expect your programs to crash occasionally, too.

    3. Re:Quote From The Article by XxtraLarGe · · Score: 1

      If you're still learning, I'd expect your programs to crash occasionally, too.

      If you're still learning, and your programs crash, I'd expect you to fix what's causing them to crash.

      --
      Taking guns away from the 99% gives the 1% 100% of the power.
    4. Re:Quote From The Article by Anonymous Coward · · Score: 1

      When I took my first intro to programming class (C++) in college we discussed memory overruns, and both how to create them and how to avoid them... (one of the assignments was to create one, that particular assignment was expected to (potentially) crash a machine...)
      We also discussed buffer overflows and all sorts of other pitfalls...

    5. Re:Quote From The Article by fibonacci8 · · Score: 2

      I would hope any computer language class would teach about fatal errors when languages are first learned, so that less time would be spent recreating the mistakes of others. Especially if you're teaching the advantages of a high level language. Knowing why and when to pick a specialty language is valuable. Hoping students figure it out themselves isn't.

      --
      Inheritance is the sincerest form of nepotism.
    6. Re:Quote From The Article by Anonymous Coward · · Score: 1

      WTF school is teaching this kind of crap

      I can answer one that does - the University of Arizona, in Tuscan.

      The professor wrote code so bad, that it was able to bring down the server when it crashed. (I was quite impressed in a morbid way)
      For example, take the simple matter of failing to check for an error condition. (Program says "Enter number between 1 and 10", and the user types "dog")

      We put in a check to make sure the input was valid. Guess what? When the assignment was graded, the professor docked 15% of the score for that check calling it a waste of time to do such things. This was only the first assignment, and things got worse as the semester went on.

      Some of these university professors are the epitome of the saying "Those who can't do, teach"

      I've interacted with other professors at other universities, some are quite brilliant, but not UofA.

    7. Re:Quote From The Article by Anonymous Coward · · Score: 3, Insightful

      Yes, because it's written wrong. Now learn how to do it correctly. The original problems this article addresses are not a learning experience environment set of problems.

    8. Re:Quote From The Article by Tom · · Score: 3, Informative

      The question is who expected this. Certainly not any professior worth anything.

      I was taught that not only compiler errors, but also all compiler warnings need to be resolved before the code is considered finished. If I had submitted a program that sometimes crashes, my prof would've asked me if I had slept through his class or if I wrote that shit while drunk.

      --
      Assorted stuff I do sometimes: Lemuria.org
  9. Not this again by Anonymous Coward · · Score: 1

    Heartbleed was a buffer overflow in an already allocated pool. Memory safety wouldn't have mitigated it.
    Memory safe languages have some advantages, but are not immune to bugs as a result. They are also less efficient.
    In my experience, they also have a tendency to leak memory, when the algorithm is complicated enough, or that other manual resource allocation had a bug in it.

    1. Re:Not this again by Waffle+Iron · · Score: 1

      Heartbleed was a buffer overflow in an already allocated pool. Memory safety wouldn't have mitigated it.

      In many memory-safe languages, the Heartbleed bug would have been highly unlikely to actually happen in real-world usage.

      The problem was that they allocated a large buffer based on a "payload size" field in the request, but the request actually had a small payload, so the message sent included the random system data between those sizes. The programmers using manual buffer management confused the principles of buffer capacity and data length.

      If they had written the program in Go, for example, they would most likely have used "slices" to hold buffers like this. Slices automatically keep track of the capacity and length for you. They probably would have allocated a slice with a capacity defined by the payload size field, but then used the append() function (or similar operation) to actually move the payload data to the slice, which keeps track of the actual length of valid data. They would then send the data from the slice in the response, and this would not include any extra data beyond the valid length.

      Further protection would be provided by the fact that the Go runtime zeros out memory when first allocated. Unless the slice gets reused, there would be no sensitive data to send anyway. If the slice were reused, it would probably contain only previous message data, which is a much smaller range of information than random data from the heap.

    2. Re:Not this again by Waffle+Iron · · Score: 1

      . In C they could also probably just have checked the length of the payload.

      But they DIDN'T.

      The Go runtime does check, every time without fail.

  10. Get good developers if you need C/C++ by Ecuador · · Score: 3, Insightful

    Bad developers can create security exploit in whatever is the language of their choice. Sure, with C/C++ you need to be more careful/experienced because they allow this particular type of bug, but in general where C is used it is possibly for a reason and you can't start talking about Java/Python etc (but maybe Rust?), which might be "safer" for a less good programmer.

    --
    Violence is the last refuge of the incompetent. Polar Scope Align for iOS
    1. Re:Get good developers if you need C/C++ by jma05 · · Score: 2

      C++ programmers think of themselves as elite.

      That is not what I see. I see more programmers who choose to NOT use C++, but know it... than C++ programmers who are good at something (a modern language) other than C++.

      Rust is safer for ANY programmer, just as Java and Python are. Rust just does not do performance trade offs as the others do for that safety and instead pays with a steeper learning curve.

      None of the C++ programmers talking about Rust seem to have learnt it. If you are so elite, learn it in a weekend and then criticize it.

      If you can't grok the borrow checker or its functional style quickly, maybe you are not so elite at all.

      I have not seen any "less good" programmers in Rust community. I have seen plenty of very mediocre programmers in C++. I'd say functional programming attracts more passionate programmers as a whole than C++.

    2. Re:Get good developers if you need C/C++ by edtice1559 · · Score: 1
    3. Re:Get good developers if you need C/C++ by complete+loony · · Score: 1

      I tried writing a small file parsing library in rust. Maybe I wasn't doing it the "rust way", but satisfying the borrow checker felt like writing recursive templates.

      How many C++ coders do you know who get templates right?

      --
      09F91102 no, 455FE104 nope, F190A1E8 uh-uh, 7A5F8A09 that's not it, C87294CE no. Ah! 452F6E403CDF10714E41DFAA257D313F.
    4. Re:Get good developers if you need C/C++ by jma05 · · Score: 1

      I certainly would not call any C++ programmer who has not jumped onto Rust an elitist fool. There may be a number of reasons to not move to something newer even if a better language is available.

      But you can call someone an elitist fool if they assume that
      - C++ is powerful, but Rust isn't, without even understanding Rust.
      - They assume they are the pros simply because they use C++. No language makes you elite.

      You can agree that Rust is, at least as a language, an improvement over C++ and supports safer idioms than even more recent iterations of C++ deliver. If you feel that the ecosystem isn't there yet or that it has not yet feature stabilized, that is a different matter.

      And no, Rust does not generate enormous binaries. It generates them at about the same size as C++. You just get static linking by default, which is a minor design choice. You also can exclude the standard library. You just have not looked into it enough. A basic stripped release binary is at 130-140K in Rust. It is about 9-10K if you don't link the standard library.

      I am not arguing for Rust per se. I am arguing for progressive evolution of language design rather than stagnating on anything for decades.

      I do think Rust is mature enough for most new C++ projects. Care to say why you think it isn't?

  11. Not a buffer overflow by thelexx · · Score: 5, Insightful

    What the author describes is not a buffer overflow. Article is ill-informed click-bait.

    --
    "Gold still represents the ultimate form of payment in the world." - Alan Greenspan, 1999
    1. Re:Not a buffer overflow by NormalVisual · · Score: 2

      FTA: (disclosure: Rust’s primary sponsor is my employer, Mozilla)

      Given Firefox's continued problems with memory management over time, I can start to get some understanding as to why, if the guy really thinks an out-of-bounds read is a buffer overflow.

      --
      Please stand clear of the doors, por favor mantenganse alejado de las puertas
    2. Re:Not a buffer overflow by jma05 · · Score: 2

      Firefox in Rust today is doing a lot better than Chrome in C++ today, especially with regards to memory consumption.

      There should not be any significant differences in memory consumption between Rust and C++, as per design since the compilers emit similar instructions.

      https://benchmarksgame-team.pa...

  12. Is the article crap or just the summary? by EndlessNameless · · Score: 5, Informative

    I decided not to read the article when I saw the following:

    Sometimes this will result in a crash, but in many cases you get whatever happens to be at that location in memory, even if that portion of memory has nothing to do with our list. This type of vulnerability is called a "buffer-overflow,"

    That is not a buffer overflow. That is an out of bounds access, which a completely different type of vulnerability.

    Sometimes, this specific access violation is called a buffer over-read, but anyone calling it a buffer overflow is simply sloppy or wrong---neither of which makes me interested in reading their material.

    --

    ---
    According to the latest ruleset, this post should be modded as Vorpal Flamebait +5.
    1. Re:Is the article crap or just the summary? by jythie · · Score: 1

      Sounds like the person is trying to describe a stack smash to me. I do not think they were talking about a segmentation fault, but instead overwriting something in their own memory space that then causes a crash.

    2. Re:Is the article crap or just the summary? by Tom · · Score: 2

      This. My first thought upon reading the summary: "Here's a person clearly not understanding what they are writing about, but asking me to follow their advise about safe programming... riiiiiight."

      --
      Assorted stuff I do sometimes: Lemuria.org
  13. A shitty developer blames the tool by Anonymous Coward · · Score: 1

    Subject says it all.

    If you pine for a "safe" language it's likely because you know you're outclassed without your training wheels.

    1. Re:A shitty developer blames the tool by jma05 · · Score: 1

      Bah, helmets. Only little kids think of such frivolous things such as safety, even when the newspapers scream accidents.

  14. Ad for Rust (author's employer) and Swift by mykepredko · · Score: 3, Insightful

    When did I first hear about "Buffer Overflow" which seems to be the bug in the author's bonnet? Oh yeah, about 35 years ago when I first started programming in C.

    When I RFTA I was floored by the statement "When I first learned C++ in college, it was expected that sometimes your program would crash." - the author implies that it just happens but that's never been true and I would really be hesitant about hiring a programmer that accepted that his programs sometimes crash.

    He doesn't like C/C++, good for him, but programming in Rust or Swift won't help the security problems out there now or in the future.

    1. Re:Ad for Rust (author's employer) and Swift by Penguinisto · · Score: 2

      "When I first learned C++ in college, it was expected that sometimes your program would crash." - the author implies that it just happens but that's never been true and I would really be hesitant about hiring a programmer that accepted that his programs sometimes crash.

      ...welcome to the Java mindset?

      (/me ducks and runs, laughing maniacally...)

      --
      Quo usque tandem abutere, Nimbus, patientia nostra?
    2. Re:Ad for Rust (author's employer) and Swift by jythie · · Score: 2

      I don't know, I am not sure I would hire a programer who tried to claim that their programs never crashed when they were a student writing them.

    3. Re:Ad for Rust (author's employer) and Swift by mykepredko · · Score: 1

      Maybe I'm overreacting to the word "crash" - I agree that I wouldn't work with anybody who said they never made mistakes in their programming (not just when they're students).

      "Crash", to me, says that the program fails spectacularly and takes down other systems around it.

    4. Re:Ad for Rust (author's employer) and Swift by Waffle+Iron · · Score: 1

      When I RFTA I was floored by the statement "When I first learned C++ in college, it was expected that sometimes your program would crash." - the author implies that it just happens but that's never been true and I would really be hesitant about hiring a programmer that accepted that his programs sometimes crash.

      I was there in the late 80s ad early 90s, and I can assure you that almost without exception, nontrivial C++ programs written in that era crashed regularly, regardless of who wrote them. The compilers were total crap and incompatible between vendors, the specifications were poor, aids like STL didn't exist or were too buggy to use, "best practices" had not yet been identified, and there were few modern software quality tools to help.

    5. Re:Ad for Rust (author's employer) and Swift by 110010001000 · · Score: 2

      Nontrivial programs crash no matter what language you are using. Most nontrivial programs are written in C/C++.

    6. Re:Ad for Rust (author's employer) and Swift by jythie · · Score: 1

      Ah. While I was reading it in more the 'student learning' way, acceptance that when writing a program there will be times when it successfully compiles but then goes down hard when actually executing. Compared to, say, when writing in Python the chances of actually _crashing_ in a way that the program hard exits back to the prompt is a lot more rare, esp if excluding simple unhandled exception type crashes.

    7. Re:Ad for Rust (author's employer) and Swift by angel'o'sphere · · Score: 1

      and takes down other systems around it.
      On a modern operation system that is not possible.

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    8. Re:Ad for Rust (author's employer) and Swift by angel'o'sphere · · Score: 1

      The compilers were total crap and incompatible between vendors,
      That is irrelevant.

      the specifications were poor, aids like STL didn't exist or were too buggy to use, "best practices" had not yet been identified, and there were few modern software quality tools to help.
      Best Practices did exist and C++ had a lint just like C: always!

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    9. Re:Ad for Rust (author's employer) and Swift by mykepredko · · Score: 1

      and takes down other systems around it.
      On a modern operation system that is not possible.

      Is this a challenge?

    10. Re:Ad for Rust (author's employer) and Swift by Waffle+Iron · · Score: 1

      That is irrelevant

      That is not irrelevant if the compiler spit out bug-ridden opcodes, which they often did.

    11. Re:Ad for Rust (author's employer) and Swift by angel'o'sphere · · Score: 1

      It is irrelevant as you did not link different object files from different compilers (because in general you could not anyway).

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    12. Re:Ad for Rust (author's employer) and Swift by Waffle+Iron · · Score: 1

      I was pointing out two different things:

      1. The compilers were incompatible in that they didn't even accept the same definition of what "C++" was, causing many developers to devote much effort in finding some common subset that would compile on different platforms, or writing a bunch of confusing #ifdefs. This resulted in less time to look for actual bugs.

      2. On a different topic not involving mutual compatibility, each of the compilers would often create new bugs out of whole cloth by spitting out bad machine code that did not conform to even what the crappy C++ specs of the time hinted should happen.

    13. Re:Ad for Rust (author's employer) and Swift by angel'o'sphere · · Score: 1

      1. is very true and the main reason why C++ was adopted so slowly, especially on Windows.
      2. I luckily never had such a bug, but I heard often about such issues.

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
  15. C? you newbies by cellocgw · · Score: 2

    I achieved this overflow with FORTRAN on a DEC PDP 11/70 back around 1974. My whole college ran on the one machine, and occasionally the overflow would feed me cool stuff like chunks of grade reports.

    --
    https://app.box.com/WitthoftResume Code: https://github.com/cellocgw
  16. python cant solve all the problems. by shaksys · · Score: 2

    Lets program the the pic16 in the coffee maker with python.

    1. Re: python cant solve all the problems. by scorp1us · · Score: 1
      --
      Slashdot's rate-of-post filter: Preventing you from posting too many great ideas at once.
  17. Article is longer than the clickbait title by Octorian · · Score: 2

    Apparently this article is long enough to actually address all the points everyone here is bringing up as a counter-argument.

    Of course its also pushing Rust, which nearly all these articles do.

    While I personally have no real opinions or experience with Rust, I don't yet see it being used very much. It mostly seems to be used for novel standalone utilities, which are not parts of larger projects.

    1. Re:Article is longer than the clickbait title by Octorian · · Score: 2

      I know its supposed to be used for that. I also know that its proponents are screaming at everyone to find every opportunity to use it for that.

      What I haven't yet noticed, is actually seeing a meaningful swath of said core libraries actually get rewritten in Rust.

    2. Re:Article is longer than the clickbait title by gweihir · · Score: 2

      Ah, the Rust fuckups are at it again. That explains it. They do not understand what makes code insecure.

      --
      Most ACs are not even worth the keystrokes to insult them. Be generically insulted by this and ignored otherwise.
  18. A large of it is due to the popularity ... by QuietLagoon · · Score: 1

    ... of C/C++, that creates an outsized number of issues. An even larger part is due to poor programming practices by the developers who write the insecure code.

    1. Re:A large of it is due to the popularity ... by gweihir · · Score: 1

      And if you look at other languages, you a whole lot of security problems that have completely different causes that have nothing at all to to with memory safety. In fact, OWASP Top 10 does not even have an item for Buffer Overflow anymore.

      --
      Most ACs are not even worth the keystrokes to insult them. Be generically insulted by this and ignored otherwise.
  19. Not overblown by sjbe · · Score: 5, Interesting

    C/C++ are important for some things. Experienced developers know exactly when and how they should be used

    A) Experienced developers do not always use them in appropriate circumstances
    B) Not all programming is done by experienced programmers
    C) One doesn't get to be an experienced programmer with C/C++ without working with the tools and making a lot of mistakes.
    D) Experienced programmers still generate bugs and security holes
    E) Tools that require the programmer to catch 100% of a known problem with known solutions are bad tools
    F) This problem with C and C++ has been known about and routinely ignored for decades.
    G) It is screamingly clear that training will not resolve this problem as a general proposition

    We have a bunch of sloppy code, written in a hurry, often by programmers who didn't know what they were doing, built over decades with tools which allow sloppy coding practices to occur. Sure there are occasionally reasons to work without the safety net but these are the exceptions that should prove the rule.

    1. Re:Not overblown by Penguinisto · · Score: 4, Interesting

      You do realize that you could pretty much replace "C/C++" with any language that has that level of access, usability, and flexibility, right?

      --
      Quo usque tandem abutere, Nimbus, patientia nostra?
    2. Re:Not overblown by olsmeister · · Score: 5, Insightful

      B)
      ____1) Experienced programmers are expensive.

    3. Re:Not overblown by NicknameUnavailable · · Score: 3, Insightful

      H) c++ has two types of reference/pointer addressing to further conflate things because it was a hack on c's syntax to begin with - it's entire existence is a hack.

    4. Re:Not overblown by jythie · · Score: 2, Interesting

      There is a an important key point here, any language that can do what C/C++ do will have those same problems, but one can ask if C/C++ is really the right tool for a lot of stuff it is being used for.

      This is why I love languages that can compile or otherwise mesh together. Use C/C++ for the places where the flexibility and access really pay off, and then switch to more restricted languages by default for most tasks.

    5. Re:Not overblown by Anonymous Coward · · Score: 1

      I consider myself to be somewhat experienced in C, and honestly, I don't understand the need for some to wave away all the problems with them.
      I would much prefer that the compiler tells me about array overflows etc, or at least give me a way to write a type that gives me automatic checking of bounds.
      Yes, sometimes you know that you are within the bounds and you don't want the performance overhead of a compare and branch instruction.
      But having to change your behavior when it would be possible for a tool to do it automatically is not the way I like to do things.

      Also, yes you can write crappy code in any language, but I would like my tools to help me catch the stupid shit in C just the same.

    6. Re:Not overblown by Megol · · Score: 4, Insightful

      What exactly is it Ada can't do but C/C++ can?

    7. Re:Not overblown by bhcompy · · Score: 2

      It's definitely something the compiler should help with, either by enforcing bounds or providing feedback. In the end, it's a compiled program, like any other. That intermediate step of compiling can make all the difference.

    8. Re:Not overblown by jythie · · Score: 1

      Imbue its users with a continued desire to live?

      But yeah, Ada is a perfect example of previous attempts to address these shortcomings, but the cost of using it outweighed the benefits of the stricter environment.

    9. Re:Not overblown by Opportunist · · Score: 2

      Not require an i7 to run like you have a 386.

      --
      We used to have a Bill of Rights. Now, with the rights gone, all we have left is the bill.
    10. Re: Not overblown by ArchieBunker · · Score: 2

      I'm not a trans otherkin. How can I possibly use that language?

      --
      Only the State obtains its revenue by coercion. - Murray Rothbard
    11. Re:Not overblown by superwiz · · Score: 2

      For someone with such a high user number, your age is showing. You are being ridiculous. Modern C++ (starting with C++11) has 3 types of reference/pointer types.

      --
      Any guest worker system is indistinguishable from indentured servitude.
    12. Re:Not overblown by ShanghaiBill · · Score: 3, Interesting

      There is a an important key point here, any language that can do what C/C++ do will have those same problems

      This is not necessarily true. There are times when you want an unbounded pointer that can access any arbitrary address, but in C, pointers are unbounded by default. It would be safer to require a specific keyword to create an unbounded pointer, so it is clear to both the writer and the reader that it is intentional. This would lead to safer code, with no decrease in capability.

    13. Re: Not overblown by Immerman · · Score: 2

      I'm intrigued, but waiting for it to stabilize. A language that can't compile code written three years ago is no kind of language for any serious task.

      --
      --- Most topics have many sides worth arguing, allow me to take one opposite you.
    14. Re:Not overblown by chiguy · · Score: 1

      B)
      ____1) Experienced programmers are expensive.

      Axiom: To become an experienced programmer, you must pass through the inexperienced stage

      --
      passetspike!
    15. Re:Not overblown by Anonymous Coward · · Score: 5, Informative

      The modern Ada compilers actually produce fairly streamlined code. While you might think that there would be an overhead penalty for having to range-check every array access, the reality is that the compiler will remove the range check if it can prove that all of the indices used are within bounds. If you are writing good Ada code (rather than trying to convert your C coding paradigms to Ada), the compiler can actually make this proof most of the time. If you add SPARK to Ada, it will force you to write always-provable code.

      I program in C/C++, Ada, and assembly, and I actually enjoy programming in Ada the best out of those three. I did not feel that way when I started learning the language, but I find my own personal error rate is so much lower in Ada (eg. once it compiles, it actually does what I want the very first time) because the compiler will catch many simple errors. I also find my code is significantly easier to read a year later when I need to revisit it to make some modifications.

    16. Re:Not overblown by NicknameUnavailable · · Score: 1

      I forgot my original password and it was linked to an email address on one of a number of old domain names I don't remember or own anymore. But yes, the multiple types of references and pointers are the issue. It's getting hackier, not better.

    17. Re:Not overblown by Penguinisto · · Score: 1

      Nobody is waving-away any of the problems (trust me, C/++ has a shitload of them.)

      The thing is, *all* languages have hazards to at least some degree, and the closer to the metal you get, the bigger the hazards.

      --
      Quo usque tandem abutere, Nimbus, patientia nostra?
    18. Re:Not overblown by 0100010001010011 · · Score: 1

      Have a well defined military specification.

    19. Re:Not overblown by jma05 · · Score: 1

      Even Python or Ruby do not make an i7 run like a 386.
      Which year did you use Ada? Which compiler?
      When I tried it some 15 years ago, it ran like Pascal i.e. slightly slower than C++, but in the ball park of any other natively compiled language, with smaller communities and fewer resources to optimize it.

    20. Re: Not overblown by phantomfive · · Score: 3, Informative

      The most common vulnerabilities right now are SQL injections and xss-type attacks. Buffer overflows are difficult to exploit these days because of all the kernel protections. Oh and what is the biggest worm right now? Mirai, which spreads by using the default password for devices. It doesn't matter what language you are using that will still be a problem.

      --
      "First they came for the slanderers and i said nothing."
    21. Re:Not overblown by jellomizer · · Score: 2

      In general, it is nearly impossible to explain to your boss that your Proof of Concept, isn't the final program.

      --
      If something is so important that you feel the need to post it on the internet... It probably isn't that important.
    22. Re:Not overblown by HornWumpus · · Score: 1

      Old joke:

      Ada is a bureaucrats language. You have to write code in triplicate. With all the fields and data rearranged on the three copies, so you can't just write an emacs macro/IDE.

      --
      John McAfee 'It was like that time I hired that Bangkok prostitute; to do my taxes, while I fucked my accountant'
    23. Re:Not overblown by SurenEnfiajyan · · Score: 1

      I don't understand the need for some to wave away all the problems with them. I would much prefer that the compiler tells me about array overflows etc, or at least give me a way to write a type that gives me automatic checking of bounds.

      It's called code static checking, but unfortunately it cannot be done at compile time for more complicated algorithms, especially with external parameters. At least partially, it can be done dynamically for debug/profile binaries, but all the checks are removed from the actual released product, and the undiscovered errors can be cumbersome to debug in the future. Also in *most* cases the runtime checked and C/C++ binaries have similar performance, primarily because even the safe languages aggressively optimize the code by eliminating redundant checks (for example, array iteration, it's not necessary to perform bound checks for every index/iterator access, it can be done once before the iteration) and also because in C/C++ the majority of such runtime checks are still performed manually or are done in standard template libraries. Just look at Rust vs C++ benchmarks, in some cases Rust generated faster code and it could be optimized even further. Also for performance critical parts (where the compiler can't eliminate the unneeded checks, or you are writing a driver) Rust lets you write unsafe blocks where no dynamic checks are performed and you can also work with raw pointers, pretty much like in C/C++. There is even an OS kernel written in Rust. The fundamental difference is that Rust is safe by default, and only in few performance critical parts you need to tell the compiler that you know 100% what you are doing. C++ is mostly C by default and C is unsafe by default.

    24. Re: Not overblown by Anonymous Coward · · Score: 1

      Terry Davis told me to program like a white man, faggot

    25. Re: Not overblown by peppepz · · Score: 1

      C is the worst offender. Other languages allow you to get low-level access to memory, but you have to request it explicitly. In C one gets all the dangerous behaviour by default, even though it's seldom needed.

    26. Re:Not overblown by Krishnoid · · Score: 1

      When the compiler catches errors like that, do you end up avoiding those errors in future code you write, in Ada and (subsquently) in other languages that don't have such bounds-checking info? It seems like working with training wheels like that for a while would get you into better coding habits that carry forward when using a compiler/language missing those safety features.

    27. Re:Not overblown by john.r.strohm · · Score: 2

      I believe it was Tony Hoare who opined, back in the late Jurassic Period, that running with checks enabled during checkout and turning them off for production was akin to wearing your life jacket in the harbor and then taking it off when you ventured out to open ocean.

      While SOME people do in fact learn, as you suggest, not all of them do. I saw too much sloppiness in production code at Nortel Networks - I can say that because the company is now dead and gone - to be optimistic about people's ability to learn.

    28. Re:Not overblown by F.Ultra · · Score: 1

      the reality is that the compiler will remove the range check if it can prove that all of the indices used are within bounds

      Which is a situation that is almost never a problem with C either, the problem is almost always with external information

    29. Re: Not overblown by Carewolf · · Score: 1

      More like 5, or 8 counting the abstract versions.

    30. Re: Not overblown by Jarwulf · · Score: 1

      Forces CoCs and mandatory pronouns and sensitivity training and tons of rules for 'positivity' and 'inclusiveness' on others. Calls the people who question it oversensitive and snowflakes.

    31. Re: Not overblown by Darinbob · · Score: 1

      I'm waiting for someone who is not a part of the cult to describe why it's good.

    32. Re:Not overblown by Darinbob · · Score: 1

      Ada is nice. The snag though is that while it is difficult to find good C programmers, it's even more difficult to find Ada programmers in the numbers necessary to keep your company afloat.

    33. Re:Not overblown by Darinbob · · Score: 1

      And yet C++ has ways to avoid all that. The snag is that they come with overhead so there are times when there is a need to bypass the safety features just to get the job done. If you use a higher level language for the same purpose, there will still be times that you need to break out and call the C or assembler routine. Under the hood of most popular languages you will find C because it's the only widely available and and widely portable low level language out there; so where in the past you'd find assembler comprising the run time libraries or kernels, today you find C.

    34. Re: Not overblown by superwiz · · Score: 1

      I am talking about address types without modifiers (no const/volatile).

      --
      Any guest worker system is indistinguishable from indentured servitude.
    35. Re: Not overblown by Phil+Urich · · Score: 1

      Username/comment synergy, right here.

      --
      I remember sigs. Oh, a simpler time!
    36. Re:Not overblown by guruevi · · Score: 1

      The problem with bounds checking on variable data is that it's slow. For every operation you have to first do a bounds checking operation (that's a JMP and a CMP at the very least). You can see these things in performance comparisons (both in memory and CPU cycle overhead) of Python and Rust vs C/C++.

      In rare cases, your compiler may even strip the bounds checking anyway depending on the platform this could be safe but injecting registers or variables from other programs (eg through a buffer overflow in the other program) then make it theoretically unsafe.

      --
      Custom electronics and digital signage for your business: www.evcircuits.com
    37. Re:Not overblown by ShanghaiBill · · Score: 1

      The problem with bounds checking on variable data is that it's slow.

      Sure, but 90% of the time, it doesn't matter if it is slow because it is not in an "hot" inner loop.

      So just profile your code, and turn the bounds check off for hot spots. Then look at those hot spots carefully to make sure there is no error in the indexing that could allow an overflow.

      You could get 90% of the safety for 10% of the cost.

    38. Re: Not overblown by brantondaveperson · · Score: 1

      It's not.

    39. Re: Not overblown by astrofurter · · Score: 1

      I dunno - Ada looks like quite a nice language. But never had an occasion to work with it. Probably because it's neither evil nor shitty, so Surveillance Valley won't touch it.

    40. Re: Not overblown by astrofurter · · Score: 1

      No it's not. Two easy steps:

      1. Raise the pay you're offering

      2. Consider hiring competent programmers who don't have specific Ada experience. It's just another fucking language. After you've learned ten languages, number eleven is not a big deal.

      Either is these two will work. For even greater effectiveness, combine them.

    41. Re: Not overblown by astrofurter · · Score: 1

      Says the guy who removed the safety guard from his circular saw and now has only nine fingers.

    42. Re: Not overblown by astrofurter · · Score: 1

      Imagine if our bosses were... experienced programmers. Instead of the business major private school ass lickers to whom our profession is normally subordinated.

    43. Re:Not overblown by DrXym · · Score: 1
      Well quite. I've written code in C and C++ for decades and I still write stupid bugs from time to time that the compiler could have caught but didn't. I sometimes write code where I could have const'd something, or might be doing something potentially unsafe (depending on what the caller does), or a raft of other little errors which might be fine in isolation but could compound to be a problem.

      That's why the likes of Rust are such a boon. The language design and the compiler stop potential bugs from even becoming code. You write code and if it compiles then you know you don't have any data races, no pointer / ownership issues, double frees, null pointer exceptions, memory management leaks. It also kicks your ass if the code isn't thread safe. It also panics at runtime if you run off the end off a buffer or do some other dumb stuff. And the runtime is more expansive than C/C++ and RAII in nature. All that and it still compiles to performant code.

      While Rust won't stop application level bugs, it eliminates a whole raft of issues inflicted by C and C++ through the design of their language. If I were starting any system level project from scratch these days I would default consider writing it in Rust first and only if that wasn't viable would I think of using C++ or C.

    44. Re:Not overblown by DrXym · · Score: 1
      I think in general Rust code will compile and execute with equivalent speed to C++. However Rust can produce vastly more efficient code when it is manipulating strings because it is all slice based. In C++ if I make a substring, I allocate a new piece of memory to copy the substring into whereas Rust can return a slice to the existing string.

      The main area for improvement is that Rust is a lot safer for multithreaded use, so it encourages the developer to think of ways to make their code more concurrent and that in turn can lead to better hardware utilisation and better performance. A simple example of that would be a command tool like ripgrep which absolutely slaughters grep and most other tools for recursive search operations because it runs in parallel over directories.

    45. Re: Not overblown by john.r.strohm · · Score: 1

      That was not my experience when I was working in Ada.

      I looked carefully at the generated object code, because of exactly those concerns. The compilers I used all generated good, reasonable object code for what we were doing.

    46. Re: Not overblown by jythie · · Score: 1

      It actually is a nice language, and a lot of what was great about it made it into later language like C++ and Java... but it was also a very tedious language to work in. Good to learn, annoying to actually build things with.

    47. Re:Not overblown by SurenEnfiajyan · · Score: 1

      However Rust can produce vastly more efficient code when it is manipulating strings because it is all slice based. In C++ if I make a substring, I allocate a new piece of memory to copy the substring into whereas Rust can return a slice to the existing string.

      Yeah, as I said, the claim that C/C++ are the most efficient high level languages is just a myth. Rust also supports low level code where you control everything, which means there are no optimization limitations. As for faster string processing, in C++ there is std::string_view which just holds 2 pointers to the start and the end of char buffer.

    48. Re:Not overblown by DrXym · · Score: 1

      C++17 onwards and the impl doesn't own the string so you get a view onto garbage if the string disappears from underneath. One thing I really like about Rust is that good ideas like slices were baked into the language & runtime and enforced by lifetime rules rather than optional, heavily caveated afterthoughts.

    49. Re:Not overblown by SurenEnfiajyan · · Score: 1

      Agreed, I didn't imply that string_view is a nice thing, it's just a "high level" dirty hack.

  20. Re:Overblown by careysub · · Score: 2

    If everyone did everything perfectly all the time there would never be any problems.

    The solution to everything.

    --
    Starships were meant to fly, Hands up and touch the sky - Nicky Minaj
  21. Mozilla and Rust by darkain · · Score: 4, Interesting

    The article is a Mozilla developer trying to push people onto Rust. And while Rust is great for *SOME THINGS*, it is still a new language that falls far too short on too many others. I've recently attempted to build some demo programs in Rust, and had not enjoyed the experience one bit. A simple "hello world" application written in Rust and compiled generates a binary that is in the order of ~500-1000KiB in size. Now, let's put this into a little bit of perspective of where I personally use C/C++ these days. I work with microcontrollers as a hobby, one of which has a total of 8KiB flash ROM. But this is just one example. Now, imagine writing an entire operating system in Rust with that type of file size. How many tiny utilities combined make up Linux or FreeBSD? Just imagine if literally EVERY single utility bundled with the OS was half megabyte in size? There are thousands of utilities, which would lead to OS bloat to an unimaginable level. Rust is promising for sure, and is doing great things for Webrender at Mozilla, but it just isn't there for smaller applications at all.

    1. Re:Mozilla and Rust by religionofpeas · · Score: 1

      A simple "hello world" application written in Rust and compiled generates a binary that is in the order of ~500-1000KiB in size

      Do you look to see what was in there ?

    2. Re:Mozilla and Rust by darkain · · Score: 1

      There is a bunch of standard library stuff that is statically compiled into every binary, regardless if it is used or not. I've searched around, and have yet to see a way to remove it or minimize it. I've seen posts about recompiling the standard library with better optimizations and less debugging, plus using a compressed binary, but the binary size is still insanely huge for small programs.

    3. Re:Mozilla and Rust by angel'o'sphere · · Score: 1

      If a simple "Hello World" is that big, it is obviously a linker problem.

      To sad that you lack knowledge about stuff like this ...

      (WTF: how can it be the language if your code is obviously only a few bytes???)

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    4. Re:Mozilla and Rust by gweihir · · Score: 1

      Ah, the Rust fuckups. No wonder. They are shamelessly lying to push their fetish. OWASP Top 10 does currently not even list Buffer Overflows in the 10 worst security issues with web-applications.

      --
      Most ACs are not even worth the keystrokes to insult them. Be generically insulted by this and ignored otherwise.
    5. Re:Mozilla and Rust by jma05 · · Score: 1

      You have not looked enough into Rust. By design, Rust should be able to do everything you can do with C++.

      Rust supports not including the standard library.

      Even with the standard library, a Hello World binary should be around 130-140 K.
      Without the standard library, it should be about 9K.

      Rust has plenty of crates that don't use the standard library.
      https://crates.io/categories/n...

      And if you are writing many small utilities for an operating system that do use the standard libraries, you simply use dynamic linking and bundle the library just once, same as C++. The executable sizes will be equivalent.

    6. Re:Mozilla and Rust by dschaeffer · · Score: 1

      There are some who do use rust for microcontrollers. Rust's defaults unfortunately do make for large binary sizes, but there are things that can be done to get similar sized binaries to C. Rust does need to make them more accessible, though.

      From the rust FAQ: https://www.rust-lang.org/en-US/faq.html#why-do-rust-programs-have-larger-binary-sizes-than-C-programs

      This is older and unofficial but still informative: https://lifthrasiir.github.io/rustlog/why-is-a-rust-executable-large.html

  22. Let's blame languages instead of crappy devs! by UnknownSoldier · · Score: 1

    /sarcasm Because PHP, Javascript, etc. are more "secure" **snicker**

    See, I can play this game too.

    You can write crappy code in ANY language. And while some languages make it far easier the problem isn't the language but the bigger problem is between the ears.

    It takes time & money to do it the right way.

    Engineering is all about trade offs -- programming is no different.

    There is never time to do it right, but there is always time to do it over.

    1. Re:Let's blame languages instead of crappy devs! by jma05 · · Score: 1

      You can't upgrade or redesign what is in between your ears. But we can radically explore new paradigms of program construction.

      As per psychology studies, we all think everyone else is incompetent, but that we are among the exceptions.

      All the high profile C++ bugs have been authored by well-compensated and highly-experienced software engineers.

      If software engineers can't improve their own tools, against well known patterns of misuse, what legitimacy do they have when they claim they can improve the tools of their users.

      Rust may not be the perfect language. But it is the first real replacement against C++ (zero cost abstractions). I hope that either Rust continues to rapidly evolve or there is an even better language than Rust. Either way, the current state of mainstream programming is poor.

  23. Comment removed by account_deleted · · Score: 1

    Comment removed based on user account deletion

  24. More Rust propagnda by 110010001000 · · Score: 2

    I didn't even finish reading the summary, but my guess is this is some sort of Rust millennial who things memory safety doesn't exist in C/C++. Sorry kids: Rust and your boutique languages will not catch on.

    1. Re:More Rust propagnda by pr0fessor · · Score: 1

      llvm is written in c++ so rust has what ever feature the c++ developer wanted you to use.

    2. Re:More Rust propagnda by thegarbz · · Score: 1

      Sorry kids: Rust and your boutique languages will not catch on.

      A language that is only 2 spots behind in popularity on Github.
      A language that is actively used in development by all of the mega technology companies.
      A language that recently topped the latest Stack Overflow survey of popularity dethroning Python.

      To channel my inner Trump: WRONG! You're WRONG! Sad. No collusion!

    3. Re:More Rust propagnda by angel'o'sphere · · Score: 1

      LLVM is a virtual machine.

      Rust and C++ are languages.

      And no: there is no overlapping in the Venn-Diagram that moves stuff from C++ to Rust via LLVM, idiot.

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    4. Re:More Rust propagnda by pr0fessor · · Score: 1

      I don't really use rust but isn't llvm a core component of the rust toolchain?

    5. Re:More Rust propagnda by tepples · · Score: 1

      Memory unsafety in C and C++ language exists wherever the standards for those languages say "the behavior is undefined". Memory unsafety in Rust exists only in an unsafe block.

    6. Re:More Rust propagnda by 110010001000 · · Score: 1

      Yeah, no. Rust ranks below Puppet in popularity. There is a reason no one uses your languages.

    7. Re:More Rust propagnda by thegarbz · · Score: 1

      Yeah, nah. Puppet ranks below Rust in popularity. Meaningless, unfounded and uncited statements are fun.

      There is a reason no one uses your languages

      My language? Never touched the stuff. Never used rust, seen it, touched it, and the only code I've knowingly run from it is in Firefox, and even then I'm not sure to what extent.

      But thanks for displaying your mentality towards the subjection by saying it was *my* language.

    8. Re:More Rust propagnda by angel'o'sphere · · Score: 1

      Yes, most likely it is, as this is an easy to use tool chain if you only have to write the compiler frontend.

      However: llvm is written in c++ so rust has what ever feature the c++ developer wanted you to use.
      This makes this statement in no way reasonable.

      Rust links to C and C++ via LLVM, a statement like this makes more sense.

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
  25. All the way down. by jythie · · Score: 2

    And what does the poster think those memory safe languages are written in? I can see the argument that C/C++ are overused, and that the jobs people throw them at could probably be done by safer languages without much performance hit.. but then again, you could just use safe libraries within C/C++ and get the same result.

    But at the end of the day, people have been aware of buffer overflow problems for what, 60 years now? And there have been solutions for them nearly as long. But when cycles are dollars, those solutions are always expensive, which is why unsafe C/C++ code is still so common.

    1. Re:All the way down. by MerlinTheWizard · · Score: 1

      Indeed, most people promoting these supposedly "safe" languages kindly ignore the fact that their internals may use or generate unsafe code even if the top-level code you write seems inherently safe.

      That sort of shifts the risk upon the compilers/interpreters/runtimes, which you'd be supposed to trust blindly. Which causes even more potential issues than using tools you know you should be careful with IMO. Excessive trust in any tool is much more risky than using tools that are known to be trickier to use. A lot more accidents are caused by an excess of trust (in yourself or your tools) than by faulty tools in general.

    2. Re:All the way down. by Anonymous Coward · · Score: 1

      That's why I took the guard off my table saw.

      You have to get the compiler right once. You have to get the actual code right infinity times.

    3. Re:All the way down. by angel'o'sphere · · Score: 1

      Most languages are self hosting.

      Java is written in Java, Scala is written in Scala ... etc. p.p.

      Oh, you are mixing up virtual machines aka runtime environments with compilers? No worries: that is a common mistake.

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
  26. It's not a deadline problem (mostly) by sjbe · · Score: 5, Insightful

    I expect that there are any number of developers who would be happy to address those issues if their managers would only put enough time into the schedule to do so

    This would account for a percentage of the problem but your argument is something of a cop out because it ignores all the other parts of the problem. You can give programmers all the time and resources in the world and if they used C/C++ these bugs still occur. People are imperfect and they make mistakes. Many programmers are inexperienced and don't know any better. These problems have been known about for decades and yet they still occur even with projects where there are no time deadlines like many open source projects.

    1. Re:It's not a deadline problem (mostly) by StikyPad · · Score: 2

      These problems have been known about for decades and yet they still occur even with projects where there are no time deadlines like many open source projects.

      There are a few points this article ignores.

      1) The attack surface of C/C++ applications is huge, because pretty much every OS and major application is written in these languages. These are High Value Targets, so of course more vulnerabilities will be discovered in these pieces of software. Blaming C/C++ for that is like blaming water for drowning, and saying we'd be safer if we replaced all water with Gatorade, since nobody's ever drown in Gatorade.
      2) Java vulnerabilities are a dime a dozen, and some of the most popular Java frameworks (like Spring) have had major issues as well.
      3) All languages suffer from inherent vulnerabilities, especially input validation issues, including deserializing untrusted data directly to objects. It doesn't matter if it's C, Java, Python, or Brainfuck.

      Additionally, the article seems to suffer from selection bias. The author writes: "From my own security research into the widely used open source image processing libraries ImageMagick and GraphicsMagic, in the last year I've found more than 400 memory unsafety vulnerabilities." That's great, and I applaud the work, but I can't help but wonder how many Python or Java libraries he examined in that time frame, or how many other types of vulnerabilities he was even looking for, or would recognize if he was looking at them.

      TLDR: It's possible the article is correct, but far more evidence is required.

    2. Re:It's not a deadline problem (mostly) by Raenex · · Score: 1

      All languages suffer from inherent vulnerabilities, especially input validation issues, including deserializing untrusted data directly to objects.

      Yes, but C/C++ suffers from all of those issues plus memory corruption.

    3. Re:It's not a deadline problem (mostly) by sabt-pestnu · · Score: 1

      You don't become experienced in C/C++ by learning Python. And you don't get experienced in defensive programming by relying on the language, interpreter, or OS to do the heavy lifting.

      Then again, you don't get a good program by shorting testing. And that happens too. The cure for inexperience is mistakes. Preferably non-fatal (or non-critical) ones.

  27. Re: It's not the language, you stupid jackwagons.. by iamgnat · · Score: 1

    But somebody mandated seat belts. And airbags. And crumple zones. And lights. And licences plates. And inspections. And I hope you get the picture.

    So you want federally mandated software development standards that, because they don't know a damn thing, would require 100% unit and functional test coverage along with passing a State approved linter and vulnerability scanner?

  28. Python or Java Couldn't Exist w/o C/C++ by Slicker · · Score: 5, Insightful

    It is impossible for those languages with "safe" memory access to exist without underlying languages that can openly access memory and that don't hide the truth of the machine beneath them. It is impossible to build an operating system in Java or Python -- they are made-up realities. They are designed to make computer pretend to work in ways they actually don't... in ways humans find easier to view and work with programming logic.

    C and C++ do not hide the underlying machine because they are made to build the layers that actually allow software to work with the machine. The machine is instruction sequences in memory that manipulate memory -- memory is a singular long sequence of bytes. At the lowest level in any computer, that's what's there. Definitely not Python or Java. Python and Java must be written in either assembly language or a "true to the machine" language like C or C++. I am quite sure without checking that they are both written in C++. In fact C was specifically created to write the first UNIX... It's core is the core of POSIX of which even Windows shares... as DOS was written in C.

    It's truly absurd to blame C and C++ memory unsafety. This illustrates a lack of fundamental understand of how computers work.

    1. Re:Python or Java Couldn't Exist w/o C/C++ by GuB-42 · · Score: 1

      The goal with memory safe languages is not to be absolutely safe, because it is impossible. The goal is to confine the unsafe parts into something manageable. It can be a small library or runtime written in C or even in assembly. Or, in the case of Rust (I didn't read TFA but I suppose it is at least mentioned), into marked "unsafe" blocks.

      No one, I think, really blames C for being memory unsafe. They blame the fact it makes the entire code base is potentially unsafe when less than a percent needs to be.

      Note that I still think that the security risks associated with C and C++, while real, are overrated when it comes to the language selection.

    2. Re:Python or Java Couldn't Exist w/o C/C++ by angel'o'sphere · · Score: 1, Informative

      It is impossible to build an operating system in Java or Python
      No, it is not. There are plenty of OSes written in Java.

      C and C++ do not hide the underlying machine
      Yes, they do. For starters: you have no access to registers. And for more information I suggest to read: https://en.wikipedia.org/wiki/...

      memory is a singular long sequence of bytes.
      Strictly speaking no, it is a sequence of "words" of arbitrary length.

      Python and Java must be written in either assembly language or a "true to the machine" language like C or C++.
      No, Python is written in Python and Java is written in Java. ... Oh?! You mean the virtual machine? There are plenty of Java Virtual machines out there that are written in ... Java. Wow ... surprised?

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    3. Re:Python or Java Couldn't Exist w/o C/C++ by Anonymous Coward · · Score: 1

      > I don't remember seeing the Java API for low-level interrupt handling.

      Well, to be fair, C can't handle low-level interrupts either. You need to link in assembly routines for that.

    4. Re:Python or Java Couldn't Exist w/o C/C++ by F.Ultra · · Score: 1

      Ok, point us then to a single operating system written in Java that does not require a non-Java micro kernel in the bottom.

    5. Re:Python or Java Couldn't Exist w/o C/C++ by Waccoon · · Score: 1

      This illustrates a lack of fundamental understand of how computers work.

      Sadly, most modern languages are designed specifically to abstract things to the point where you can't understand how computers work. Preps you for a career in phone and tablet walled gardens, I guess.

    6. Re:Python or Java Couldn't Exist w/o C/C++ by angel'o'sphere · · Score: 1

      Google is your friend. The famoust one is even simply called JavaOS.

      Must be hard to swallow that there are dozens of Java compilers that generate native code ... or why do you pretent to be ignorant? :P

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    7. Re:Python or Java Couldn't Exist w/o C/C++ by F.Ultra · · Score: 1

      And it have a microkernel in C, as have every other Java OS that I've found. There's a reason why I specifically asked you to name a single one and that reason was not due to me not being able to google these things ;)

    8. Re:Python or Java Couldn't Exist w/o C/C++ by angel'o'sphere · · Score: 1

      It is obvious that you can write that micro kernel in Java that emits native code ... so what is your point?

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    9. Re:Python or Java Couldn't Exist w/o C/C++ by F.Ultra · · Score: 1

      For that to work you also have to add functionality to the Java language that does not exist there yet, which is the reason why not a single Java based OS to this date have written such a micro kernel in Java. As Java stands right now something have to provide what the JVM provides (threading, memory allocation, communication with the underlying hardware and so on), whether you compile to native code or not have nothing to do with this.

    10. Re:Python or Java Couldn't Exist w/o C/C++ by angel'o'sphere · · Score: 1

      As Java stands right now something have to provide what the JVM provides (threading, memory allocation, communication with the underlying hardware and so on), whether you compile to native code or not have nothing to do with this.
      All this has to do with compiling to native code.
      Communication with the underlying hardware is simply accessing the memory mapped IO ports of the devices ...

      There are probably a dozen Java based OSes out there. No idea which rely on a micro kernel and which provide the kernel themselves. That is not relevant for me.

      With a compiler that generates arbitrary native code, the language, as in C/C++, Java, Pascal, Modula 2, Ada: is completely irrelevant.

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    11. Re:Python or Java Couldn't Exist w/o C/C++ by F.Ultra · · Score: 1

      You say dozens but I could only find 7 projects that claim to be Java Operating Systems and out of them only 3 didn't require to run atop of an existing OS (aka they required to run from a JVM). Perhaps that exists more out there but too be honest it looks kinda thin.

      The ones that I found was:
      JNode : microkernel in assembler
      JavaOS : microkernel in C
      JX OS : microkernel in C
      GVM : runs atop a JVM
      Alta : runs atop a JVM
      J-Kernel: runs atop a JVM
      JikesNode: runs atop a JVM

      The most prominent ones are JavaOS from Sun and JX and they both run atop a microkernal written in C for the obvious reasons that I've already stated. Compiling Java to native does not magically introduce things that are not normally available in Java if run on a JVM. I'm no Java hater (I kinda like Java) but one have to accept that it has it's limits and being able to provide 100% of what a OS needs is not one of them.

    12. Re:Python or Java Couldn't Exist w/o C/C++ by angel'o'sphere · · Score: 1

      I'm no Java hater (I kinda like Java) but one have to accept that it has it's limits and being able to provide 100% of what a OS needs is not one of them.
      Compiling to native code and being able to access arbitrary memory, is all what you need to write a pure OS ... in any language.

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    13. Re:Python or Java Couldn't Exist w/o C/C++ by F.Ultra · · Score: 1

      So why do all Java OS:es use a microkernel written in C to handle all these things if it's possible to do it in Java. Why does there not exist such a pure Java OS anywhere?

    14. Re:Python or Java Couldn't Exist w/o C/C++ by angel'o'sphere · · Score: 1

      Because it is easier to implement it that way instead of changing all the Java infrastructure around it?

      This one e.g. is not micro kernel based: http://www4.cs.fau.de/Projects... but it is over a decade old.

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    15. Re:Python or Java Couldn't Exist w/o C/C++ by F.Ultra · · Score: 1

      Sorry but JX uses a microkernel as well. It was in my initial list.

    16. Re:Python or Java Couldn't Exist w/o C/C++ by angel'o'sphere · · Score: 1

      Yeah, but according to the web site it is written in Java.

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
  29. C++ compilers should have a "safe" mode by SpinyNorman · · Score: 5, Insightful

    C++ is really two languages in one: backwards-compatible C and modern C++, and unfortunately there's nothing to stop programmers from inappropriately using low level C features when safer C++ alternatives (smart pointers, STL data structures) would be a better choice.

    The C++ standards body should define a "safe-C++" subset that doesn't allow legacy features like C-style arrays and raw pointers. The compilers could have an option to enforce safe mode and only allow exceptions in sections of code explicity marked as unsafe (#pragma unsafe ?).

    1. Re:C++ compilers should have a "safe" mode by 110010001000 · · Score: 2

      Um, I am pretty sure all compilers have these kinds of flags already. I know Microsoft's had that 10 years ago. GCC has dozens of flags for overflow detection, etc. Rust developers are just ignorant Millenials who think they have discovered something new.

    2. Re: C++ compilers should have a "safe" mode by TimMD909 · · Score: 1

      You mean use a linter with a good ruleset?

  30. Lousy or inexperienced programmers are the problem by whitroth · · Score: 1

    I wrote C for a good number of years. Within a year or two of programming in it professionally, I was using string functions that limit the length, like strncpy, and 95 times out of 100, I used for/next loops, NOT WHILE (forever) loops.

    If you're not doing that, you've got a lot to learn.

  31. Do people really get paid to write that? by Ryn · · Score: 2

    What's next? An article on dangers of failing brakes in cars?

  32. Re:What he said was true by 110010001000 · · Score: 2

    Um, I've never heard someone way that it was expected a program can crash because it was written in C/C++. Any program can crash, no matter what language you write it in. How does Rust keep programs from "crashing" (a.k.a stopping abnormally) if there is a non-recoverable error in them? You can catch exceptions probably, but you can do that in C++ as well. The reason your Rust programs don't crash is because they are typically trivial demo programs. There is nothing magical about Rust. You can reduce buffer overflow errors with languages like that, but you can also do that if you use semi-modern C++.

  33. K&R by Ukab+the+Great · · Score: 3, Funny

    I donâ(TM)t know why K&R rewrote Unix in C; it was a far more stable and secure operating system in the original JavaScript.

  34. Re:What he said was true by suutar · · Score: 1

    To me, "just happens" carries the connotation of "for no reason", and _that_ has never been true. There's a reason. Usually programmer error, sometimes hardware error, rarely random glitch. But there's always a reason and the vast majority of the time it's human error.

    You're quite correct that crashes are to be expected, especially in a learning environment. And that's how I read the article author's statement too. But I can see where mykepredko could read it otherwise and disagree with that reading.

  35. Re:Overblown by sycodon · · Score: 3, Interesting

    So you are making the Fast Food Argument.

    Sure...it's bad for you...might even kill you.

    But it's quick and it's tasty!

    --
    When Fascism comes to America, it will call itself Anti-Fascism, and tell you to give up your guns.
  36. Enter Modern C++ by scorp1us · · Score: 3, Interesting

    So I'm a long time C++ Dev, but have been trying to wrap my head around modern C++ (2011 to current) and it seems that there are a lot of improvements that would avoid those kinds of errors.

    Unfortunately I observed that C++ is becoming less about writing your program and more about telling the compiler how to build it. It's also filled will all kinds of new acronyms, like SFINAE and CTAD, and new concepts like costexpr.

    But I think it's all too little too late. Check out this "simple" map():
    std::vector originals { 1,2,3};
    std::vector triples;
    std::transform(originals.begin(), originals.end(), std::back_inserter(triples), [](int item){ return item*3; });

    Who wants to write that code? How does that code convey the intent to the user? You know it's doing a map because I told you. But that code was written for a compiler, not a human to understand.

    --
    Slashdot's rate-of-post filter: Preventing you from posting too many great ideas at once.
    1. Re:Enter Modern C++ by swilver · · Score: 2

      No, not really. What sucks is having to learn the many quirks of modern C++. Any language has quirks, but none has as many as C++. And I thought Javascript was a piece of garbage... enter C++.

    2. Re:Enter Modern C++ by angel'o'sphere · · Score: 1

      The only thing not easy to grasp is the lambda in the middle: "[](int item){ return item*3; }"

      But as I write Java, Groovy and Scala: this is no problem for me. And yes, I stay in touch with C++ enough to know they have lambdas, too now.

      And yes: I like to write that code, but probably I would have used a standard STL map function instead.

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    3. Re:Enter Modern C++ by Anonymous Coward · · Score: 1

      Or:

              std::vector originals{1,2,3};
              std::vector triples;

              triples.reserve( originals.size() );

              for (auto&& x:originals)
                  triples.push_back(x*3);

      or, with a small fmap function:

              auto triples = fmap( originals, [](auto&& x){return x*3;} );
      or, if a proposal gets accepted for C++20:

              auto triples = fmap( originals, [](x) => x*3 );
      the code you wrote is mostly C++03 with a C++11 lambda. It is like someone pointing at the model T and saying "who would want to ride that to work? Cars suck, I much prefer horses."

    4. Re:Enter Modern C++ by 110010001000 · · Score: 1

      Yeah, like I said it sucks to have to learn new stuff.

    5. Re:Enter Modern C++ by 110010001000 · · Score: 1

      Then don't write code like that. I don't know anyone who writes C++ like that. You can write obfuscated code in any language.

    6. Re:Enter Modern C++ by 110010001000 · · Score: 1

      Then don't use them. I don't myself.

  37. And the solution? by ponraul · · Score: 3, Insightful

    Rewrite the everything in their favorite/cool 2018 language, instead of using using the newer features of C++ which are designed to mitigate these problems.

  38. Re:Touch a Nerve or Something? by Anonymous Coward · · Score: 1

    There's a million libraries that enforce array boundaries, if you want it done for you, then feel free to use one of them. But for those of us who would rather not run code that is essentially

    for(i = 0; i < array_len; i++)
    {
        if (i > 0 && i < array_len)
        { //do stuff
        }
        else //throw exception
    }

    we'd rather not. I don't need double array bounds checks. I know how to code.

  39. C doesn't have seat belts. by Fly+Swatter · · Score: 2

    If you are used to a language with seat belts, like java, and you still routinely get ejected, maybe C isn't for you.

    1. Re:C doesn't have seat belts. by jma05 · · Score: 1

      And if you are using a language without seat belts and you routinely are getting ejected (state of exploits today), perhaps you should consider seat belts (GC) or better traffic rules (the borrow checker or some other compile time system).

  40. I dunno by jd · · Score: 1

    Verified C, the CERT C Secure Programming standards, the JSF coding standards, Power of Ten, the Hoard malloc replacement, Valgrind, LLVM's static checker, Z3, contract programming - all partial solutions that show some developers care.

    Linux could use a mix of these to achieve higher levels of reliability without impacting performance or capability.

    So could most software.

    And therein lies the problem. Some developers don't care, or are opposed to people caring. The numbers don't matter, one person can block a thousand. Change requires consensus.

    --
    It's a small world and it smells funny; I'd buy another if it wasn't for the money; Take back what I paid (SoM)
    1. Re:I dunno by angel'o'sphere · · Score: 1

      Some developers don't care, or are opposed to people caring.
      Most programmers don't know

      Stop being an asshole implying that programmers write bugs deliberately.

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    2. Re:I dunno by jd · · Score: 1

      Never said they wrote bugs deliberately, said they stopped people from writing correctly. And, yes, I've seen programmers do both. "It's faster and the corner case won't happen" is a familiar excuse.

      Y2K was an example.

      Bad programmers, bad managers, bad specifications, seen it all. Makes me want to puke. None of it can be justified.

      --
      It's a small world and it smells funny; I'd buy another if it wasn't for the money; Take back what I paid (SoM)
    3. Re:I dunno by angel'o'sphere · · Score: 1

      Y2K is only an example if people still used 2 digit years in the 1990s.
      Till the mid 1980s, no one really was aware to the problem.

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
  41. Re:C? you newbies by ponraul · · Score: 1

    Heatbleed wasn't even a buffer overflow. It was a buffer over read.

  42. Re:Touch a Nerve or Something? by Megol · · Score: 1

    I think you mean create C for non-idiots?

  43. Re:Touch a Nerve or Something? by 110010001000 · · Score: 5, Interesting

    I don't understand. C/C++ compilers have had options to enforce boundary checking for over 10 years now (at least). Are people really unaware of these things?

  44. The nature of C and C++ by mykepredko · · Score: 1

    I think suutar said it best by saying if a program crashes, there is always a reason for it; maybe it's your code, maybe it's a bad API, maybe the processor caught on fire. There's always a reason for it.

    When you are learning to program, you should be learning how to write code that doesn't crash on its own - the implication in the article was that C++ programs crash, that's life. There are too many programmers out there that consider random crashes to be not their fault and don't bother spending any time understanding the problem - because, chances are, it's their fault.

    It's not "devilishly hard" to keep C/C++ programs from crashing. The big thing that it takes is accepting that if a program crashes, it's your fault as the programmer until you can prove otherwise.

  45. Wrong language? by DarkRookie2 · · Score: 1

    I think the internet has a lot more problem with JavaScript than it does with C\C++

    --
    http://progressquest.com/spoltog.php?name=Son+Of+Son+Of+DarkRookie
  46. Nothing is stopping a rogue program from lying about its buffer size it supplies to an API, even inside the ultimate runtime type safety of some languages.

    Anyway, the Internet world, AKA the desktop world in a previous incarnation, could use some catching up to the high-liability embedded world, where buffer size checks are required. It still won't stop rogue programs from lying, but should catch internal errors and mistakes.

    --
    (-1: Post disagrees with my already-settled worldview) is not a valid mod option.
  47. Re:Let's all switch to JavaScript! by Opportunist · · Score: 1

    Until you arrive in callback hell, that is.

    --
    We used to have a Bill of Rights. Now, with the rights gone, all we have left is the bill.
  48. Ridiculous by CustomSolvers2 · · Score: 1

    Imagine you had a program with a list of 10 numbers. What should happen if you asked the list for its 11th element?

    If you develop a program expecting to deal with a list of 10 numbers and you allow scenarios where the 11th element could be requested, you would have done a horrible job in any programming language. Period.

    Let's now assume that you made the aforementioned mistake (your fault, something perfectly avoidable in any scenario by a reasonably competent programmer) and that an error happens. Under the most logical conditions (99.999999 etc. % of cases), the only difference between these two scenarios is that you would get an error message with a slightly specific, but still quite generic label (not being too useful anyway, but indicating that the given environment caught the error) or a meaningless message referring to some problem with the memory. It might be possible (although tremendously improbable) that the non-managed language would access another valid memory location and, consequently, no immediate error would be triggered. But, even in that case, it would be just one step within the millions of them forming even the simplest piece of software. For example, imagine that this extremely-lucky event occurred in step number 1234th, it would move to step 1235th where that value would have to make sense (otherwise, it would crash there) and then to step 1236th, etc. And so on until the end of the program which, in the tremendously improbable scenario of reaching, would output a random result.

    In summary, number of malware attacks provoked by this kind of memory virtually-impossible lottery? Not too many (zero?). Complete responsibility of 100% of all the bugs/malware/vulnerabilities: the given developer (directly or via ridiculous conditions, wrong previous code or similar). Is improving the working conditions something bad? Certainly not. Are managed-memory/newer languages absolutely superior? Certainly not. They have their advantages and drawbacks, are (dis)liked by different kind of people/companies. There is actually lots of hypocrisy on this front as far as escaping from the managed-memory constraints does accelerate things quite a lot and many newer/more popular languages do allow these kind of things (e.g., C# or Go). There is certainly nothing bad with C or C++ or similar for those feeling comfortable with them and doing a proper work. There is something very bad with (probably programming clueless) people thinking that "training wheels" are required for something as demanding and requiring as highly skilled workers as programming. The higher the freedom, the better the final product. The higher the knowledge/experience/awareness, the better the final product. The more clueless the decisions makers, the worse everything.

    --
    Custom Solvers 2.0 = Alvaro Carballo Garcia = varocarbas.
    1. Re:Ridiculous by swilver · · Score: 1

      If you develop a program expecting to deal with a list of 10 numbers and you allow scenarios where the 11th element could be requested, you would have done a horrible job in any programming language. Period.

      I guess you fail to understand that this is a simplified example to illustrate the problem. Perhaps a GIF/JPG/JSON/XML parser is complicated enough?

      The point is, in C you just created a potential exploit, which will lie dormant or perhaps cause some rare unexplained crashes every now and then in testing IF you're lucky... In safe languages, you just get a stacktrace telling you what a dumb fuck you are.

    2. Re:Ridiculous by 110010001000 · · Score: 1

      In modern C/C++ compilers you will also get a stacktrace. I think the problem is that you haven't learned anything since 1998.

    3. Re:Ridiculous by CustomSolvers2 · · Score: 1

      I guess you fail to understand that this is a simplified example to illustrate the problem. Perhaps a GIF/JPG/JSON/XML parser is complicated enough?

      I guess that you fail understand that you can propose an as complex example as you wish and my answer/expectation would always be the same: if you do it properly, it would work fine in any language. If you make a mistake because of your generic incompetence or because of not feeling too comfortable with that specific language or because of whatever other reason, it would be your responsibility even back when you decided that you were able to perform that development/use that language properly. Regarding the example you are proposing, I have created many parsers myself and, in fact, I love doing this kind of things. I don't see these scenarios as particularly difficult, perhaps because of my experience in that.

      I do realise that there are many situations which are very complex and, despite knowing that doing everything properly step-by-step and having full control on each single part would certainly drive to an error-free result, I would accept that some errors there could be acceptable. In fact, performing a relatively complex development (mostly defined by size rather than by the exact problem being addressed) in a language like C is certainly very unappealing and even error-prone. Even a big deal of experienced C programmers loving that language would prefer more friendly alternatives under certain conditions. This is the key idea that you and your kind fail to understand: the only ones talking about a binary distinction, it is horrible or perfect, everything works or not is you. Sensible, reasonable and practical people will take advantage of what they have at their disposal without getting involved in ridiculous absolute discussions aiming for what doesn't even exist. Modern, managed-memory languages are very useful for many things and have had a very important impact in how the software world has evolved. Languages like C are also very important for other aspects (low level programming or parts where the speed is the most important issue) and should also be used accordingly. C is much more difficult/unfriendly, mainly for people used to newer platforms, but it doesn't mean that it is bad or unsafe, not in the right hands. Additionally, it is simply irreplaceable, not just because the huge number of systems built on it (historically and currently) but also because of providing what other languages simply can't (precisely because of dedicating much more resources to being programmer-friendly), and consequently having discussions of this sort seems pointless.

      The point is, in C you just created a potential exploit, which will lie dormant or perhaps cause some rare unexplained crashes every now and then in testing IF you're lucky... In safe languages, you just get a stacktrace telling you what a dumb fuck you are.

      What potential exploit are you talking about? Again: if you create a buggy program, it would be your fault (example: you are crazy and want to kill people for no reason). PERIOD. If you aren't experienced enough, comfortable enough, it is certainly more likely that you would create a buggy program by relying on a less friendly environment, but again it is your fault (example: you are crazy and want to kill people for no reason, but you have or not access to weapons). PERIOD. If you want to start thinking about the differences between having created a buggy program with most of modern languages or a language like C, you should take a look at my previous post which clearly describes what are these differences: practically speaking there is no difference. There might 1 chance (out of billions of billions of billions of billions.... of possible scenarios) where a program might be successfully terminated against the original intention, but this would involve the aforementioned avoidable buggy essence and a combination of events which might be safely assumed to be impossible (example: y

      --
      Custom Solvers 2.0 = Alvaro Carballo Garcia = varocarbas.
    4. Re:Ridiculous by CustomSolvers2 · · Score: 1

      dumb fuck you are.

      Even though I quoted that part in my previous reply, I didn't read that last bit. Have you insulted me?! Why?! Let's recap (you seem the kind of person who needs lots of recaps, summaries, simple instructions... you know? Not thinking much, just repeating whatever set of simple ideas you are given in that specific moment). So, I am here writing a post sharing my ideas in a reasonably high level of detail about a technical issue. You could agree or not with them (well... I guess that, your case, it would be more a matter or understanding them/not), ignore it or interact with me. You "choose" (I quote it because one of the basic requirements for being in a position to perform a real choice is being able to understand the possible alternatives and voluntarily decide which one is better, what doesn't seem your case) to not agree with me + interact with me.

      Because of whatever reason (pure ignorance, true incapability or being intentionally obtuse), you firstly misinterpreted my intention and assumed an idea which seems so ridiculously stupid that I have honestly never met anyone in a position to deliver it ("I guess you fail to understand that this is a simplified example to illustrate the problem")?! This is seriously what the people with whom you usually interact do with examples? They aren't able to understand that it is a restricted representation of the true reality only meant to help understand it? Or are you the one usually doing that? Do you have problems to understand what examples are for? What is the reason for that? Is it some kind of physical/mental limitation or your ignorance/shortsightedness? By thinking about it a bit more carefully, I am starting to feel a bit sorry for you. So, I will try to help you a bit. See. I have been running a set of bots/crawlers for a while now, they are creating a custom-made web-domain ranking. I tried to explain that idea to a relatively old person with no tech knowledge. That person happens to work with small kids (is this perhaps your problem? You aren't used to deal with adults?) and that's why I thought that a clear example for her was the following: "Imagine that you have a bunch of kids who are playing. The game is that you send them to a given address, they go to that address take a small item there and bring it back to you. After bringing that small item, they go back to a new address and so on". See? My bots have nothing to do with kids and they aren't playing and have nothing to do with (postal) addresses. This was an example helping that person to get the real idea. That person should have processed those simpler-for-her ideas, get a good enough global picture and then go back to reality (outside the fictitious example) to apply that new knowledge to what really matters (understanding what my bots do), by being aware about the differences (logically, a piece of software has nothing to do with a kid). Do you get it now? I was commenting about an example to explain a point. Any properly-understanding person should have taken it as a starting step to understand said point. Exactly the same that I understood that the person writing the summary used that simplistic example as an easy way to transmit certain idea (i.e., managed memory vs. non managed memory).

      After that petty misinterpretation, you (again not sure if intentionally or forcibly via whatever intrinsic limitation you might have) ignore the technical essence of my point and bring generic, because-I-say-it-so statements on the lines of "Perhaps a GIF/JPG/JSON/XML parser is complicated enough" (?! Do you have the slightest idea about the huge amount of different possibilities from tremendously-simple to very complex which might be included within that statement?) or "C you just created a potential exploit" (?! Seriously, what are you talking about?) or "In safe languages, you just get a stacktrace" (?! I don't even need to analyse the veracity of that sentence, just its point: are you complaining about exploits which I still fail to understan

      --
      Custom Solvers 2.0 = Alvaro Carballo Garcia = varocarbas.
  49. the real danger by Micah+NC · · Score: 1

    The real danger is having 7 years of experience in C/C++ and then trying to land a dev job.

    Framework knowledge ... skill with pointers ... Linux/Windows ... IDE/GDB debugging ... doesn't matter.

    1. Re:the real danger by Actually,+I+do+RTFA · · Score: 1

      Huh? What do you mean? Only kids are getting hired? Or are you saying 7 years is insufficient?

      --
      Your ad here. Ask me how!
    2. Re:the real danger by Micah+NC · · Score: 1

      Well ... THAT is a major problem too.

      There's more people with C++ skills than there are C++ positions.

      The 7 years part was intended to imply one wasn't keeping up with other stacks (was my story), but that isn't necessarily true.

  50. Blame the programmers by aglider · · Score: 1

    Not the languages!
    You insensitive programming clod!

    --
    Sent as ripples into the electromagnetic field. No single photon has been harmed in the process.
  51. Computing power is speed. Or security. by Opportunist · · Score: 1

    And that's basically the net problem you're looking at. Whether it's C++ vs. Java or whether it's Meltdown and Spectre vs. speculative execution.

    Yes, you can do everything you do in C++ in Java. Just more slowly. Why? Because of exactly the safety belts that you ask for. Can they be implemented in C++? Sure. For about the same cost. So is Java better because it already has them while you have to take care of them yourself in C++? Depends, if you need them, yes. If you don't need them and all you care about is speed, no.

    The question is what do you want? Security? Then you'll have to sacrifice performance. That's not negotiable.

    --
    We used to have a Bill of Rights. Now, with the rights gone, all we have left is the bill.
    1. Re:Computing power is speed. Or security. by Anonymous Coward · · Score: 1

      >Yes, you can do everything you do in C++ in Java. Just more slowly. Why? Because of exactly the safety belts that you ask for.

      Are you sure? Did you try modern Java with JIT? It's often *faster* than C.

      >The question is what do you want? Security? Then you'll have to sacrifice performance. That's not negotiable.

      It is negotiable. Furthermore, there's no reason that CPU architectures can't include the bounds check in the original instruction and/or tag the memory so it knows which block belongs to which object - and some do. Let's have some meager progress in the computer industry, shall we?

  52. Re:Lousy or inexperienced programmers are the prob by Opportunist · · Score: 1

    Yes, that's another thing. But if you only have code monkeys that were taught how to "code" in a 8 week seminar with zero idea of the basics of computer science, who consider the heap the pile of clothing in their room and the O-notation something that grades the quality of porn movies, you might actually be better off with languages where you can't fuck up too much. They won't benefit from the speed advantages a language closer to the processor may grant them while they will benefit from the handrails and training wheels available in the more self-sealing languages.

    --
    We used to have a Bill of Rights. Now, with the rights gone, all we have left is the bill.
  53. Re:The problem by Opportunist · · Score: 1

    But ... but ... everyone should be a programmer! They should teach it in schools so EVERYONE learns how to write code!

    --
    We used to have a Bill of Rights. Now, with the rights gone, all we have left is the bill.
  54. Hence the Phrase by bchat · · Score: 1

    "and Developers Don't Want to Deal With It." They'd rather deflect the blame to the programmers, even when the best programmers still make these mistakes. The Linux kernel has had its fair share of buffer overruns and "out of bounds" security issues and it is written by good programmers. It's even read and reviewed by good programmers. But, the bugs are still there. The problem is inherent to the language because it is a machine-level problem and C gives you access to the machine. The way forward is not to throw out the language, but to recognize the cause of the problem and fix it. That's what we do when we find a bug. So the language needs to be updated, at least as an optional feature, so that it is capable of detecting these kinds of problems. This is not the kind of problem where you can just say, "managers need to hire better programmers." It's been 20+ years and that hasn't worked! It's way past time to fix the problem. You could say developers are negligent because they know the problem exists and refuse to do anything because they just want to redirect the blame away from their favorite language. This is not the fault of businesses because they've already recognized the need for languages that don't have this problem (Java, Python, PHP, Perl). It is the fault mostly open source developers who insist on using C without fixing the problem.

  55. Re:Overblown by Zmobie · · Score: 4, Insightful

    I hate this argument and always have. By straight raw number comparison yes C/C++ are faster than most managed languages. Problem is most of the zealots that parrot that don't bother to tell you it is typically only a few milliseconds, often nanoseconds, faster on the general operations (hell there are instances where is is actually slower, though admittedly not as many, Dictionaries are a great example). Even in compound highly abstracted layers of code you might see a 5 to 10 ms difference on the operation if you can manage an apples to apples comparison (which typically you can't unless it is a very trivial operation because the coding style between C/C++ is vastly different than even C#) for a very compute intensive algorithm. Even then, the main reason the execution speed is better at all is because the C++ optimizer is significantly better and more mature than a lot of other languages. As we have seen more improvements to the compilers and optimizers of other languages the gap has closed (even Java and C# are surprisingly fast these days with their respective JITs).

    Even theoretically, the performance hit you're referring to is merely a constant added onto the performance calculations because they are able to perform checks based on memory allocation of the heap in managed languages. Hell, it isn't even a great comparison because C/C++ has to perform scope checks to ensure certain objects are even supposed to be accessing the memory in question that is already allocated to that process. Access violations can still occur in those languages.

    At the end of the day very few users can tell much of a difference between a managed and unmanaged language's program, but error rates are way higher in the unmanaged languages (some of it is general unfamiliarity and learning curve of the language, but even experienced developers will still have higher rates from what I've seen). For general use, I dislike C/C++ for writing programs because of the maintenance factor and how many "roll my own" algorithms that can be required, but I will completely agree it does still have solid and semi-common use cases (embedded systems are ruled by those languages and probably will be for a long time). For me, it comes down to using the right tool for the job, and for a lot of business solutions, a managed language is just more suited to doing the work.

  56. Re:Java is the solution by bchat · · Score: 1

    Ha Ha! As a Java programmer, I approve this message. It's a little exaggerated but nonetheless true. You get safety but you have to pay for it with RAM.

  57. Sorry, but Not A OOP Fan. by BrendaEM · · Score: 2

    I think I understand the value that C++ brings to bringing large groups of people to work on a large project, but a lot of dirt piles up in the little corners.

    --
    https://www.youtube.com/c/BrendaEM
  58. How About DLang by garlicbread2 · · Score: 2

    Personally I think if you were trying to translate an already existing project from C / C++ across to something more memory safe, DLang with memory management might be a better option.
    With Rust the fundemental design philosophy is different in terms of features (good or bad) such as lack of object inheritance.
    This means it's not just a straight forward translation, with Rust you'd need to spend a lot of time re-orientating how the code is arranged.
    This is less of an impact for new projects but has a bigger impact on existing code bases.
    A language that's more similar to the prior code base / features but has better memory management would probably be a better option such as DLang (or maybe even C#).

    During the good old days before the internet, languages were designed typically in isolation inside companies, without any form of input from a global perspective. This is how we ended up with C / C++ in it's current form.
    Higher level languages such as basic's or Java would have performance hits due to not being as close to the bare metal but would be easier to write. So typically you'd use different languages for a given purpose. C for kernel and drivers, C++ for desktops, Higher languages like Java for desktop apps.

    With the internet and github and more time we now have better compilers, so if you google "C# vs C++" for example you'll see a lot of discussion on that topic. With better compilers this narrows the gap between the higher and lower languages.
    The main advantage though for the higher level ones such as statically typed managed languages is to pick up on bugs before the code is even compiled.
    So in this day and age it's a much closer trade off depending on what task your actually trying to do.

    My own bias is C# for Higher level stuff like backends of websites, and DLang for lower level stuff.
    Although micropython is also a good option for MCU's.
    Rust I feel is a little too restrictive on it's feature set

  59. We have a major problem with power tools by TomGreenhaw · · Score: 1

    Can you believe they still make chain saws? Think of all the children who will be maimed!

    Why can't everyone use plastic knives which are of course so much cheaper and safer? You don't need to be a lumberjack to know this.

    We need to pass laws to regulate these irresponsible people.

    --
    Greed is the root of all evil.
    1. Re:We have a major problem with power tools by VampBoy · · Score: 1

      I also vote we wrap everyone in the "millennial" range in bubble wrap or incase them in giant hamster balls.

      --
      the cake is a lie
  60. Wrong tool for the job by sjbe · · Score: 1

    You do realize that you could pretty much replace "C/C++" with any language that has that level of access, usability, and flexibility, right?

    You do realize rather few use cases actually need that level of access and flexibility? A LOT of code is written in C/C++ that definitely does not need to be and probably should not be. Limitations are not always a bad thing and its rather rare that a programmer is going to run into a problem that only C/C++ can solve.

    The problem isn't that C/C++ don't have good uses. The problem is that they are used WAY too often for problems that don't truly require what they offer. When a decision is made to use C/C++ there are certain categories of bugs like the ones here that are absolutely, positively, going to happen some percent of the time. The solution is to use a different and safer programming tool whenever possible. Just because you can do it with C doesn't mean you automatically should.

    1. Re:Wrong tool for the job by lgw · · Score: 5, Interesting

      C/C++ is not a language.

      C cannot be made safe. It's a language for when you really need raw access. It's a language for kernels, and for writing languages. It's a language for when a memory address actually represents a temperature sensor (if you've ever wondered what a "const volatile int" was). People definitely use it beyond those bounds.

      Heck, it's just tradition that keeps kernels in C. Very little of a kernel needs to be.

      C++ can be used in a very safe way. All the libraries support it. The continuing problem is that people don't do that. They write "C/C++", that is, they write C++ as if they were writing C. The fact you can do that may make C++ irredeemable for security-conscious code.

      I find that very frustrating, having written C++ for years without a memory leak or buffer overflow (it's easy if you use the right primitives). But it would be very hard to police junior coders and keep such vulnerabilities from creeping in, and I wouldn't start a new project in C++ if security was any concern.

      At least with C you know where you stand, and that if security is paramount you need to minimize it to where it's the right tool, review it heavily, fuzz test it, and so on.

      --
      Socialism: a lie told by totalitarians and believed by fools.
    2. Re:Wrong tool for the job by Darinbob · · Score: 1

      So, not hypothetically, I've got a Cortex-M series chip with 20K of RAM and 128K of code space, and you don't want me to use C on it. What language do you suggest that more than 3 people in the world know?

    3. Re:Wrong tool for the job by CronoCloud · · Score: 1

      Assembler.

      Or a BASIC interpreter in a ROM, perhaps with the ability to load machine language subroutines from DATA statements.

      Those were fairly traditional on machines with specs similar to yours

    4. Re:Wrong tool for the job by smithmc · · Score: 1

      Assembler.

      Or a BASIC interpreter in a ROM, perhaps with the ability to load machine language subroutines from DATA statements.

      Those were fairly traditional on machines with specs similar to yours

      And, of course, assembly is so much safer than C.

      --
      Downmodding is the refuge of the weak. Don't downmod, make a better argument!
  61. Re:Overblown by Tailhook · · Score: 1

    The problem with this finger pointing at programmers, managers and companies and the other rationalizations made in defense of C and C++ is that the opposition has an endless supply of ammunition. The clock is ticking on the next monster headline making flaw that shakes "the Internet," and the odds are great that it will be yet another memory safety exploit. And this process isn't going to stop. On November 15, 2019 a new story may appear that chronicles that latest bunch of memory safety exploits attributable to flaws in C/C++ code that appear between now and then.

    At some point the Powers That Be will get tired of suffering the consequences of these flaws and seek solutions. I can't predict exactly what they will do but I can predict what they won't; they will not adopt the vaunted wisdom of the denizens of Slashdot and limit software development to that tiny — and probably mythical — cohort of programmers that write flawless code.

    --
    Maw! Fire up the karma burner!
  62. Ada v. C Re:Not overblown by davidwr · · Score: 1

    What exactly is it Ada can't do but C/C++ can?

    "Be better than the other" if the only metrics are producing small, efficient binaries that run on bare metal.

    If it could, then it would eliminate some of the features that make Ada different than C - it would just be another procedural language.

    Sometimes Ada is a better tool than C, sometimes C is a better tool than Ada. Sometimes neither is better than the other. Same goes for any other pair of languages.

    --
    Knowledge is how to play a game, intelligence is how to win, wisdom is knowing what game to play.
    1. Re:Ada v. C Re:Not overblown by egilhh · · Score: 1

      small, efficient binaries on bare metal, like the BBC Micro:Bit? https://blog.adacore.com/ada-o...

    2. Re:Ada v. C Re:Not overblown by jma05 · · Score: 2

      Most of the time, any decent non-C natively compiled language is better than C, except for a small set of cases that have a small enough to be humanly manageable codebase that cannot absolutely afford to make any performance compromises.

      It isn't that C does not have a place. It does. It just should not be used as the default systems language.

      If you are not willing to place a lot of resources into verifying C/C++ code, the marginal performance penalty imposed by safer, yet still natively compiled languages is more than worth it. No, I am not saying that other languages are error proof, but they do eliminate entire classes of errors quite common in C/C++.

    3. Re:Ada v. C Re:Not overblown by HornWumpus · · Score: 1

      There are many non-C languages that support pointers. C is just the most common.

      --
      John McAfee 'It was like that time I hired that Bangkok prostitute; to do my taxes, while I fucked my accountant'
    4. Re:Ada v. C Re:Not overblown by jma05 · · Score: 1

      Most native compiled languages have pointers, for when you need them, which is how reasonable languages should be constructed as.
      C's no compromise attitude to performance and memory makes it suitable for a very small set of domains.
      C is popular because it is so simple and so easy to implement. Every target has a C compiler.
      And there is a large programmer base.
      But now those programmers want to use it everywhere because that is what they are good at (and perhaps the only thing they are good at).
      Even the best C programmers still make mistakes that simply won't happen in other languages.

  63. Fix it at a higher level. by AnotherBlackHat · · Score: 1

    Attacks target the easiest thing first.
    By default C has no bounds checking, and it's an easy error to make, so there are a lot of those kinds of errors.
    Bounds checking could be added, or you could use a language that has bounds checking, but that just means the attacker will go after the next most vulnerable part of the system.
    If Heartbleed was impossible we'd just have more attacks like shellshock.

    If you want real security, change the OS so programs can't access anything outside their own memory space - like write to disk, or read files outside of their current directory, or open network sockets, etc.
    If an app absolutely has to access something sensitive, make it easy to access it through a safe interface and really hard to do it directly.
    In fact, make it so I can optionally lie to to an app if it asks for something sensitive like location data.

  64. Re:Touch a Nerve or Something? by banjonz · · Score: 1

    if (i > 0 && i array_len) Ummm - is it really your intention to throw on the first iteration of the loop?

  65. Re:What he said was true by fibonacci8 · · Score: 1

    When I first learned C++ in college, it was expected that sometimes your program would crash.

    When I first learned C++

    first learned

    I think you glossed over the important part of the sentence. It was expected when first learning C++ that programs would crash. Not "for no reason" but for "having just begun learning" about it. It's similar to finding out that it's expected to fall off a bicycle when starting to learn to ride a bicycle. It's from lack of experience. Sure it's possible to get it right the first try, yes it's more likely with training wheels. C/C++ is learning to ride without training wheels.

    --
    Inheritance is the sincerest form of nepotism.
  66. Re: It's not the language, you stupid jackwagons.. by sjames · · Score: 1

    I'm not so sure that's the right answer. Perhaps if the standards would add various built-in bounds checking, that might be a better answer. Naturally, it would need a directive to override it for some situations and a compiler option to turn it off for legacy code.

  67. C/C++ are not the problem by Murdoch5 · · Score: 1

    If you ask for the 11th number, your program, if written correctly, will check the input and then return you either nothing or an error, because you don't return what you don't have. Blaming "memory unsafe" languages instead of the developers whom use them, is like blaming the car for getting into an accident and not the driver.

  68. Re: It's not the language, you stupid jackwagons.. by Penguinisto · · Score: 1

    So you want federally mandated software development standards that, because they don't know a damn thing, would require 100% unit and functional test coverage along with passing a State approved linter and vulnerability scanner?

    Well, in some cases... those already exist.

    --
    Quo usque tandem abutere, Nimbus, patientia nostra?
  69. Re: It's not the language, you stupid jackwagons.. by phantomfive · · Score: 2

    Perl 6 is better. In Perl 6 even grammars are great and easy to use.

    --
    "First they came for the slanderers and i said nothing."
  70. C/C++ problem is more C, less C++ by Stormy+Dragon · · Score: 1

    The problems with C++ aren't with C++ per se, but rather with C developers who switch to C++ and continue using C idioms (e.g. an array is int * instead of std::vector)

  71. White space by jabberw0k · · Score: 1

    Python also has a crack dependency on tabs versus spaces, despite tabs being equivalently set at every 8 spaces as God and DEC (but I repeat myself) intended.

  72. Re:Overblown by HornWumpus · · Score: 1

    Most compilers for all those languages (including C) let you turn bounds checking on and off.

    People debug with bounds checking, then turn it off for speed. Java is an obvious exception, it's always slow.

    --
    John McAfee 'It was like that time I hired that Bangkok prostitute; to do my taxes, while I fucked my accountant'
  73. Re:Lousy or inexperienced programmers are the prob by swilver · · Score: 1

    Except strncpy leaves plenty of room to shoot yourself in the foot as well, just like almost everything in the C/C++ world. It for example doesn't guarantee NUL termination of the copied result.

  74. BS.. by SuperDre · · Score: 1

    It's not due to C/C++, also memory'safe' languages have been problematic. I mean, how many problem have we had with Java or javascript.. Most malware attack vulnerabilities in other software..

  75. Re:What he said was true by SuperKendall · · Score: 1

    I'm coming at it more from a Swift perspective. I'm not talking so much about exceptions (though that is one area where a program can crash) but more memory errors in general. If you are using Swift and not bridging to C, you will not have memory overruns.

    I am also speaking after decades of C, C++, Objective-C, and now years of Swift experience. Swift reduces a a lot of areas where you would find memory related bugs in traditional C or C++ applications... I am not talking about trivial applications, I am talking about production applications that have tens or hundreds of thousands of lines of code (yes, even in Swift there are programs of that size now).

    It really is well past time the industry moves past C++, whatever that takes.

    --
    "There is more worth loving than we have strength to love." - Brian Jay Stanley
  76. but... the 286... by Ancient_Hacker · · Score: 1

    Way back Intel took some architectural advice from the old Burroughs mainframes, and put into the 286 chip 4096 special segments, where each segment had its own base and length limits. Smart compilers could be written to allocate a separate segment for each struct or array, as could malloc(), automatically preventing buffer overflows with only minor hardware overhead. Unfortunately the protect mode on the 286 was hard to get into and out of, and 4096 segments was just too few for comfort, and yo'd have to rewrite DOS and Windows a fair amount to work in that mode, and it didn't integrate well with existing real-mode code, so it never really caught on. So we abandoned safety 30+ years ago and never looked back.

  77. Re:Python,Java = Joke by oh_my_080980980 · · Score: 1

    That or a RUST salesman.

  78. Re:C/C++ is not a language by angel'o'sphere · · Score: 1

    C/C++ is not a language

    C/C++ is one.

    No, it is two different languages. And it helps to be aware of that!

    --
    Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
  79. idiots with a tool are still idiots by Tom · · Score: 1

    all three were made possible because the software that was being exploited was written in programming languages which allow a category of errors called "memory unsafety."

    Or, you know, you could just learn to do proper programming.

    Back in university, I taught my students to do proper input validation and buffer checks in C. There was a certain amount of frustration as I sent them back again and again, but they got it.

    C is a tool, and like a chainsaw, you can hurt yourself or others badly with it if you don't know how to use it. But sometimes a chainsaw is exactly what you need. And for performance, a well-written C program still beats the shit out of all other high-level languages.

    --
    Assorted stuff I do sometimes: Lemuria.org
  80. Re: It's not the language, you stupid jackwagons.. by Uecker · · Score: 1

    Out-of-bounds accesses are undefined behaviour so a C compilers can already add run-time bounds checking. To some degree this is already possible, e.g. use gcc -fsanitize=bounds

  81. Can we please stop this nonsense? by gweihir · · Score: 2

    The problem is not C or C++. The problem is incompetent developers. They manage just fine to make things in other languages just as insecure.

    --
    Most ACs are not even worth the keystrokes to insult them. Be generically insulted by this and ignored otherwise.
    1. Re:Can we please stop this nonsense? by theweatherelectric · · Score: 2

      If you genuinely can't understand the design flaws in C and C++ and the costs they have imposed on the industry then you lack experience and insight and you have no place in this discussion.

    2. Re:Can we please stop this nonsense? by gweihir · · Score: 1

      Thanks and same to you. You seem to be unable to grasp the little problem that coders that produce buffer overflows in C and C++ will just produce other security vulnerabilities in other languages. In addition, buffer overflows are pretty simple to find with automated tools, while these other bugs are not. There is NO silver bullet. What has imposed the cost to the industry is hiring incompetent coders, not any use of a specific language.

      Case in point: OWASP Top 10 does not even list buffer overflows in the top 10 vulnerabilities of web applications and has stopped doing so in 2007.

      Now go away and let people with actual insight handle this discussion.

      --
      Most ACs are not even worth the keystrokes to insult them. Be generically insulted by this and ignored otherwise.
    3. Re:Can we please stop this nonsense? by theweatherelectric · · Score: 1

      What has imposed the cost to the industry is hiring incompetent coders, not any use of a specific language.

      You keep making the mistake of telling yourself fairy tales. Your C evangelizing relies on articles of faith, campfire stories, and straight up mythology. Look what happens when a C programmer uses Rust. The things they thought they knew turn out not to be true.

      Now go away and let people with actual insight handle this discussion.

      I can appreciate that you are intimidated. But don't worry about it, kid. Just let the adults get on with the real work.

    4. Re:Can we please stop this nonsense? by gweihir · · Score: 1

      What a despicable propaganda piece. No, I am not "evangelizing" C. It is a tool. It is not a question of faith. You seem to be caught so deep in the Rust-lies that you cannot see reality anymore.

      --
      Most ACs are not even worth the keystrokes to insult them. Be generically insulted by this and ignored otherwise.
    5. Re:Can we please stop this nonsense? by theweatherelectric · · Score: 1

      What a despicable propaganda piece.

      Oh, you're serious. Poor dear.

    6. Re:Can we please stop this nonsense? by gweihir · · Score: 1

      You are a fanatic. And deeply stupid, like all of them. I will ignore you now.

      --
      Most ACs are not even worth the keystrokes to insult them. Be generically insulted by this and ignored otherwise.
    7. Re:Can we please stop this nonsense? by theweatherelectric · · Score: 1

      A sad display, son. I will play the world's smallest violin for you.

  82. Re:Touch a Nerve or Something? by SpinyNorman · · Score: 1

    So if the programmer has a function shoot_self_in_foot(char *buffer), sometimes passed pointers to arrays of various sizes, maybe sometimes to buffers allocated on the heap, where is the boundary that should be checked?

    A static analysis tool (which an incompetent programmer anyways won't be using) could at best warn you that certain usages are suspect. The compiler can't generate runtime code to check since all it has is a raw pointer with no known limit. The C ABI doesn't even permit passing a pointer limit even if one were known.

    The real solution is only to use unsafe languages where you have to. Most user land programs shouldn't be using things like raw pointers.

    It's all very well to say the programmer should be careful or should use this or that verification tool/option, but at the end of the day people make mistakes (especially given the modern race to the bottom trend of hiring cheap incompetent programmers), and once you've chosen to use a language where shooting yourself in the foot is an option, you can guarantee that it will happen.

    Incidently I happen to think C++ (not C) is a fine language for writing applications in, but too bad it relies on programmer constraint to use safe features and avoid legacy C ones.

  83. Re:Why do we still get more bug in Java and Python by gweihir · · Score: 1

    shit coders => shit software, regardless of circumstances. You can easily write insecure web-applications in any language you can write web-applications in.

    --
    Most ACs are not even worth the keystrokes to insult them. Be generically insulted by this and ignored otherwise.
  84. Wrong by duke_cheetah2003 · · Score: 1

    There is nothing wrong with C/C++ and it's rather powerful implementations of memory management. The only thing wrong here is sloppy programmers who seem incompetent enough to forget to add simple bounds checking to their code.

    Quit blaming the tools.

  85. Re: It's not the language, you stupid jackwagons.. by sjames · · Score: 1

    Yes, and that's a step in the right direction. Next step is to make it a standard, complete with pragmas or other directive to disable it on a single access. Then, once it is well deployed and everyone is well warned, make that the default with a compiler option needed to turn it off.

  86. C/C++ isnt the problem.... by geggam · · Score: 1

    Javascript is... Entire Internet is a mess because of that crap. Who thought it was a good idea to let javascript get to the cpu ?

  87. C is Assembler 2.0 ... by Qbertino · · Score: 2

    ... and C++ is Assembler 3.0. Ignore this and you'll always write software that introduces these bad heavy impact bugs at low level. Get off your high horse however and pull that stick out of your ass and stop banking on "we've been doing C for 30 years now and I'm not having some young whippersnapper tell me what's what" and you'll actually learn some really useful stuff. Like Ocaml, Rust or Eiffel and be amazed at how productive you can be and how sound the quality of your output is based on the PL you're using.

    To quote demotivator on this: "Tradition - just because you've always done it this way doesn't mean it's not incredibly stupid."

    My 2 cents.

    --
    We suffer more in our imagination than in reality. - Seneca
  88. A few milliseconds is forever in computer time by DidgetMaster · · Score: 4, Insightful

    ...Even in compound highly abstracted layers of code you might see a 5 to 10 ms difference ...

    I hate to break it to you but 5 to 10 ms is a huge amount of time when you are dealing with big data. Try sorting a 1 billion row table when each row takes a whole millisecond to get in order. That's a million seconds! For the math challenged out there it is nearly 300 hours!

    1. Re:A few milliseconds is forever in computer time by Zmobie · · Score: 1

      Of course, but that should be considered during the design/architecture phase of the program/algorithm anyway. If the data set could grow that large, absolutely that run time increase needs to be considered unacceptable (I actually berated a senior developer once for this exact issue...), but if that code is not going to be running on that large a set then it really isn't going to make a difference to anyone.

        Code quality still needs to be considered, because if someone submits an algorithm for review that runs in O(n^3) when only a few changes could make it O(n) you damn right they will be told to rewrite it immediately. However, as I said in my post, the cases where this is important are not nearly as common, the risks and maintenance headaches are much greater in low level imperative style languages, and nothing precludes the developer from using the faster language when speed it is of such importance. Nothing is stopping me from writing performance critical code in C++ and creating a small interop to run it with C# in the controller. The overhead of such an implementation is negligible on most systems, and when it is then I would consider C/C++ to be the better option.

      I complete cede that, again, the right tool should be used for the job, but I also subscribe to the thought that the right tool often times is not C/C++ regardless of who wants to argue that it is the end all be all tool.

  89. The issue isnt C/C++ by DarkOx · · Score: 1

    For all but the most unusual embed projections, and kernel level code finding memory leaks and related problems in C/C++ is as simple as running an STA tool. Admittedly good ones are expensive but static analysis can find most all of those problems.

    This issue people are not doing it.

    However while the occasional drive by like Eternalblue results from memory unsafe languages (again system level stuff most application layer programs are not dealing with) it is rare. The vast majority of software problems are application logic issues. Take the libssh author by pass. That isn't a C/C++ problem its a problem of the authors implementing the authentication logic badly. Send commands in an unexpected order the software does unexpected things. Its probably more dangerous to reimplement widely used well tested things like libssh because if a bug like that was hiding for years; who thinks someone can monkey up a java/C#/rust/... replacement and not introduce serious new unknown flaws? I for one don't

    --
    Repeal the 17th Amendment TODAY! Also Please Read http://www.gnu.org/philosophy/right-to-read.html
  90. Beter blame CPU design by Frans+Faase · · Score: 1

    Buffer overruns would not be as dangerous as they are, if stacks would not grow downwards, but upwards. Only because they grow downwards, they can be exploited to overwrite the return address on the stack in such a way that a system call is made.

  91. Re:Let's all switch to JavaScript! by Zehsi · · Score: 1

    then use lua, tho you can't write an OS in it like c++

  92. Re:Touch a Nerve or Something? by jma05 · · Score: 2

    In C++ land, every programmer is a bad programmer.

    We are not talking about a college student who learnt C++ last year, who has yet to learn good practices and common sense.

    Nearly every C++ bug that makes the news was from high profile projects, written by well-paid and highly experienced programmers. And yet, these blunders are common place.

    At some point, one has to conclude that the tool isn't designed according to natural human limitations of otherwise intelligent people.

  93. Re:C/C++ is not a language by jma05 · · Score: 1

    As long as C++ compilers compile C code, it is a perfectly valid contraction.
    There may be 2 different languages there for very different purposes, but people do often use them together and hence the contraction.
    The contraction exists for the unique circumstance of C++.

  94. Not a problem with C/C++ but a human problem by Vapula · · Score: 2

    C language is well known and has no inherent problem. it's behaviour is well documented and you get what you program with it... nothing less, nothing more.

    If you use something like while(*a++=*b++); it's at your own risk... The only assurance that C gives you is that the assembler code that'll be generated will exactly do what you asked.

    Problem is manyfold :

    1) many people don't care about low level anymore
    We have a plethora of "high level languages" which hide what is done beneath. Too many programmers don't know what's happening under the hood (well, with some langages, it's nearly impossible due to some level of secrecy about the inner working).
    Thinking about the potential consequences of a line of code is becoming quite difficult...

    2) CS teaching is not enough centered about secure practice
    This is linked to a problem that affect the whole teaching system : teachers usually don't use their knowledge in "real" situation. Far too many teachers ended up as teacher after university without ever working in their study domain. They only have an academic knowledge and as result, they often forget about the security good-practice and such (disclaimer : I'm CS-teacher... but I also worked as programmer before... and I see the above problem with many of my coworkers, not only CS-Teachers)

    3) Management usually push for quick and dirty coding
    Too many management forget about the security aspect : the program must be ready as fast as possible, putting aside optimisation, security checking and other, ... everything that is not visible... The thing may even be aggravated when the management is computer illiterate and unable to understand the issues...
    The management has usually zero-liability for problem arising from program they supervised... so they have no incentive for such a long term investment... If the program is out quickly, they'll most likely get bigger bonuses and that's their only focus...

    4) High level languages hide incompetence
    It's way easier to make a runnable program using high level "script" languages (PHP, Python, C#, ...) than using a lower level one (ASM, C, C++, ...) No need to care about memory allocation, bound checking, ... and many errors will trigger an exception and can be hidden.
    This won't make the program any better... It'll just hide the mistakes... And having something running will too often be enough for the management who don't care to have a look under the hook. I saw my share of awful code done by an incompetent coworker... But with some small-talk and such he used to be able to make it "pass"... he attributed the slowlessness to external factors and until I arrived and had a look at his code, there was nobody who could point the issues...

    And I could go on...

    Basically, if the program is broken, it's not the langage's fault but the programmer's fault (and often the manager's because he didn't request an high security level). The problem was minor for a long time, because the computers were not connected 24/7... but now, such an error may have devastating results (remind the Nimda worm which exploited an IIS buffer overflow... and infected all exposed IIS in less than 24 hours ?)

    Better training about securing the code during CS school (and after) and making managers liable for big security problems could help to limit the problem...

  95. Re:Touch a Nerve or Something? by feenberg · · Score: 1

    I think most compilers will move the bounds check out of the loop, at least if some level of optimization is requested. However the main problem for C-style languages isn't arrays but pointers. It seems to be harder for the compiler to check pointer references.

  96. Re:So, Vice is bad at tech journalism too by theweatherelectric · · Score: 1

    My father taught me that bad carpenters blame their tools.

    He should have taught you that good carpenters don't use bad tools.

  97. Re:Touch a Nerve or Something? by 110010001000 · · Score: 1

    Or the software was written before this was available. People forget a lot of this software is very very old.

  98. Re:Touch a Nerve or Something? by 110010001000 · · Score: 1

    If you are using char * in 2018 you don't know what you are doing. That has nothing to do with C++. You can write unsafe programs in managed languages as well. It is just no one really uses things like Rust, so people haven't experienced it yet.

  99. Re: Touch a Nerve or Something? by 110010001000 · · Score: 1

    Right. So use managed pointers and bounds checked accessor functions. That has nothing to do with C++. If you don't program safely you won't have safe programs, no matter what language you use.

  100. Re:Overblown by Darinbob · · Score: 1

    These languages are used in places where performance is important. The key feature of most languages with strict array and memory safety is that they're much slower and larger than C/C++. So the solution here is to abandon C and go straight to assembler?

    The biggest problem I see with C/C++ is that the developers are aging out. Newer programmers may be more familiar with computer security issues, but they're also avoiding lower level languages.

    Also note that there are a vast number of security issues in high level languages as well. Pointing to C/C++ as the problem is very short sighted. I think much more malware gets distributed from web sites using Javascript or other high level languages than from applications or operating system kernels.

  101. WHOOSH by SuperKendall · · Score: 1

    I never said everyone should use Swift. I was saying what I knew to be true BECAUSE OF my experience writing a LOT of C++, a LOT OF C, and a LOT OF Swift. Rust is not that dissimilar, I've juts not had as much experience writing real code with it.

    I appear to be the only one left that has professional experience in a wide variety of languages...

    Rust would be fine. Maybe Go. Whatever, because *I* am a professional I could care less which way the market blows, I will be fine. But I can tell you with certainly that your adherence to stupidly old languages like C++ is a bad idea and it's a bad idea for all the poor non-technical bastards that suffers every day because of your poor choices in maintaining a technical status quo that is morally unforgivable.

    I'll let you have the last response, since I see no need to further debate a point that you are so far in the wrong on.

    --
    "There is more worth loving than we have strength to love." - Brian Jay Stanley
  102. Re:Overblown by Darinbob · · Score: 1

    Most programmers today, sadly, have only ever programmed in a PC, and probably only ever in Windows. To them, worrying about being fast or tiny is unimportant, and they don't even understand the concept of portability. Many of them today don't even really program and instead just tie together pre-built components.

  103. Re:Overblown by Darinbob · · Score: 1

    It's more than just a few milliseconds or nanoseconds unless you're on a PC (the equivalent of last decade's supercomputer). When you're on a system with less then 1MB of memory and an instruction takes 1us, you're usually not going to be using Java or Python.

    (though there are exceptions, I know one chip that uses Java applets on top of an 8051 base)

  104. Re:Synopsys Coverity by Darinbob · · Score: 1

    It's a good tool, but expensive for home use, and somewhat complex to set up at work.

    Good training helps too - as in, just because you can manage all your array operations with a pointer doesn't mean you should; and if you're using buffers you need to put in overflow and underflow checks. Generally it's not hard because so many C programmers have done this over and over that they know how to do it. The snag is from the person who learned how to program by using libraries and has never actually written low level code before.

  105. Re: Overblown by astrofurter · · Score: 1

    "predict exactly what they will do"

    Lower wages and import more H1-Bs. That will fix it!

  106. Java, .Net even Lisp faster than C++ in practice by aberglas · · Score: 1

    In real experiments I have done over the years. Take a real piece of C code and rewrite it in a decent language.

    One reason is that Java and .Net do aggressive inline expansion of called methods, and then optimize the hell of what is produced. C programmers tend not to put all their methods in header files to enable this. C programmers also like opaque data types so that libraries can be updated without recompilation.

    C++ programmers tend to use the STL to avoid memory issues. This means every time you assign a string you are copying a complex structure rather than just a pointer.

    But the big one is that C/++ programs require 64 bit pointers to access more than 4 gig of memory. Java can access 32gig of memory with 32 bit pointers (relying on alignment). There are not many practical applications that require more than 32 gig. Doubling the pointer size unnecessarily is a huge overhead in memory consumption, cache hits etc. The need for 64bit is almost entirely driven by the primitive C programming language.

    Modern (1980s) generational garbage collection is impossible in C. But it is faster than reference counting and avoids fragmentation. (It does require discipline to not create too much garbage in the first place.)

    Java and .Net also use UTF-16. Which is idiocy, but is not fundamental.

    And .Net has an unsafe mode if you are game.

  107. Re: No problems with my first post algorithm by arglebargle_xiv · · Score: 1

    I sense a shitty developer.

    And you've summed up the problem in one. Shit developers can write equally shit code in any language, no matter what it is. If everyone were to switch to MPL (My Pet Language) instead of C, we'd still be seeing endless security bugs, only they'd be bugs in MPL, not in C. In this case as soon as I saw the first line of the article:

    Alex is a software security engineer at Mozilla

    I knew what was going to happen, as soon as he finished bashing C it'd turn into a sales pitch for Rust, his MPL. And, sure enough, a few paragraphs down, hey, look at MPL, Rust will solve all our problems, no need to think about educating the people writing the code to actually write secure/safe code. Yeah, and relying on abstinence will solve teenage pregnancy problems, we don't need to bother with educating people there either.

  108. Re: It's not the language, you stupid jackwagons.. by phantomfive · · Score: 1

    It essentially solved all the problems. People who think JavaScript automatically solves memory leak issues are ignorant and need to be educated because their code inevitably sucks.

    --
    "First they came for the slanderers and i said nothing."
  109. Re: It's not the language, you stupid jackwagons.. by Raenex · · Score: 1

    It essentially solved all the problems. People who think JavaScript automatically solves memory leak issues are ignorant and need to be educated because their code inevitably sucks.

    You keep blathering on about memory leaks when the topic is security and invalid memory access.

  110. Safest language for the use case by sjbe · · Score: 1

    Blaming C/C++ for that is like blaming water for drowning, and saying we'd be safer if we replaced all water with Gatorade, since nobody's ever drown in Gatorade.

    I'm not blaming C/C++. Those languages are what they are and there is a lot of good that comes with the problems. I'm blaming programmers for using those languages for use cases that don't really require them or using them when they don't fully understand what they are doing. If C/C++ are truly the best/only way to properly solve a problem then it makes perfect sense to use them. But like with many things their biggest asset is also their biggest liability. Having total flexibility and minimal/no safety net means that the problems we are discussing here become inevitable if used inappropriately. You are quite right that the attack surface is huge so it makes sense to mitigate that problem by using tools with a smaller attack surface whenever feasible.

    Sure you can have problems in other languages too. Nobody should claim otherwise. But as a general principle I would argue that as a principle one should use the "safest" language for the use case possible. If that happens to be C/C++ then so be it but it seems obvious that programmers are using C/C++ in many cases because that's the language they know best and we have an "have a hammer so every problem becomes a nail" situation. I think in many cases we have a lot of programmers who are ill equipped to handle the amount of flexibility and power C/C++ grant. Think of it like handing the keys to a Corvette to a new driver - they just haven't learned how to properly handle that sort of power yet and some never really will.

  111. Hardly News by nagora · · Score: 1

    Pretty well the first criticism of C++ was that it lacked automatic garbage collection and proper array objects (or any objects at all, really). How long ago was that?

    --
    "Encyclopedia" is to "Wikipedia" what "Library" is to "Some people at a bus stop"
  112. Re: It's not the language, you stupid jackwagons.. by iamgnat · · Score: 1

    So you want federally mandated software development standards that, because they don't know a damn thing, would require 100% unit and functional test coverage along with passing a State approved linter and vulnerability scanner?

    Well, in some cases... those already exist.

    Ahhh yes. DISAster, I remember working with them well. In 2008 I spent 6 months fighting with them to get approval to use SSH host key authentication for host automation rather than the already approved RLOGIN method. They are only "slightly" behind the times...

    Yes they do have some very useful recommendations, but working in an environment where those recommendations actually have weight proves my point. They can at times be a major hindrance and getting changes or exceptions made is a nightmare task. This can range from having to rewrite already existing tools/packages (and all the associated bugs and support headaches) due to complications bringing in 3rd party (OSS) items or them simply being behind (sometimes by a decade or more) the power curve of modern standards.

    My argument isn't that we don't need any regulation, just that regulation is not it is all it's cracked up to be.

  113. Re:I would love to see a computer by john.r.strohm · · Score: 1

    Would you settle for ALGOL?

    Burroughs did that with the B5000 series, several decades ago.

  114. Re: It's not the language, you stupid jackwagons.. by phantomfive · · Score: 1

    If you can't keep track of your memory, how are you going to write secure code?

    Security? Invalid memory accesses are too hard to exploit these days with things like ASLR and other kernel protections. They can still be exploited but it's not nearly as easy as it used to be. If you want to use C and still be safe, you can create an API for dealing with memory chunks.

    The most common types of vulnerabilities these days are things like SQL (or noSQL) injection, and XSS. Invalid memory access doesn't even make the top 10, but of course you already know that.

    --
    "First they came for the slanderers and i said nothing."
  115. Re: It's not the language, you stupid jackwagons.. by Raenex · · Score: 1

    If you can't keep track of your memory, how are you going to write secure code?

    If you don't eat your meat, how can you have any pudding?

    Security? Invalid memory accesses are too hard to exploit these days with things like ASLR and other kernel protections. They can still be exploited but it's not nearly as easy as it used to be.

    You just contradicted yourself.

    If you want to use C and still be safe, you can create an API for dealing with memory chunks.

    Or you can spare yourself a lot of pain and just move to a language where that happens by default.

    The most common types of vulnerabilities these days are things like SQL (or noSQL) injection, and XSS. Invalid memory access doesn't even make the top 10, but of course you already know that.

    Oh, really? Invalid memory issues still make up around 20%, and it's the single-highest category of security vulnerability, even more than XSS, and more than double SQL injection.

  116. Re: It's not the language, you stupid jackwagons.. by phantomfive · · Score: 1
    --
    "First they came for the slanderers and i said nothing."
  117. Re: It's not the language, you stupid jackwagons.. by Raenex · · Score: 1

    That's "The Ten Most Web Application Security Risks". Web applications. Most web applications are not written in C/C++.

  118. You can text and you can drive... by bussdriver · · Score: 1

    Human teams have limited mental capacity and time, even capable teams do not like unnecessary cognitive load or TIME getting in the way; therefore, libraries are linked and C++ OOP is used.

    You can text and you can drive but you can't do both at 100% at the same time.

    The backlash is from competent people who are defensive about needing the crutches other languages force upon you. They may NOT need them; however, they are choosing to distract themselves like a texting driver. Very few deeply technical situations require attention at this level of detail. A hybrid compromise is why C++ became so huge... but it needs to address this problem by default before it finally adds the kitchen sink. Place too many complex issues on developers and they will make errors beneath their skill level (which is likely higher than non-C programmers.)

  119. Re:Overblown by Zmobie · · Score: 1

    Oh I agree there entirely. Like I said in my post, C/C++ still rule the embedded systems with an iron fist because those small differences are amplified 1000% when available resources are so restricted. I've seen it in practice far too many times to disagree and am much too familiar with the theoretical side to think otherwise. As I said, right tool for the job comes first. I may dislike the languages but that doesn't mean I won't use them where appropriate.

  120. Re: It's not the language, you stupid jackwagons.. by phantomfive · · Score: 1

    All web applications are partly written in C. Your link was deficient because it didn't include web applications, which is where most of the code written today actually is. Furthermore, you haven't actually tried to exploit those. A single buffer overflow can't be exploited on a modern system, it takes more vulnerabilities than that.

    --
    "First they came for the slanderers and i said nothing."
  121. Re: It's not the language, you stupid jackwagons.. by Raenex · · Score: 1

    ll web applications are partly written in C.

    The vast majority of web applications are not written in C. The operating system and other underlying software is, but that's not what the OWASP paper was talking about.

    Your link was deficient because it didn't include web applications, which is where most of the code written today actually is.

    My link had columns for XSS and SQL injection. I explicitly mentioned them in my reply. Aren't you tired of being so wrong about obvious things?

    A single buffer overflow can't be exploited on a modern system, it takes more vulnerabilities than that.

    It depends on the vulnerability. Also, at the minimum, they often result in a crash. But the fact is that buffer overflows are resulting in exploits.