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.

663 comments

  1. No problems with my first post algorithm by Anonymous Coward · · Score: 0

    Fully optimized with modern c++ to gaurentee the fristiest of psots!

    1. Re: No problems with my first post algorithm by Anonymous Coward · · Score: 0

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

      I sense a shitty developer.

    2. 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?
    3. 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.

  2. Synopsys Coverity by Anonymous Coward · · Score: 0

    Use a better lint tool

    1. 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.

  3. Let's all switch to JavaScript! by Anonymous Coward · · Score: 0

    It's 500x slower and uses 1000x more memory than C++, but it's super safe!

    1. 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.
    2. Re: Let's all switch to JavaScript! by Anonymous Coward · · Score: 0

      It has its own typical security flaws, but indeed no buffer overflows ;)

    3. 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++

  4. 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 Anonymous Coward · · Score: 0

      Or run testing s/w that looks for these and points them out. It is not like it takes more than a couple minutes to put in the safeguards, once you are aware of all the issues (shortcuts) taken in the name of prototyping/speed of delivery.

    3. 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.

    4. 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.

    5. 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.

    6. 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
    7. 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.

    8. 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.

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

      I've seen legacy code where there was a of-by-one error in the code. It was fixed by original developer by adding another unused variable under it. There was a comment that said something like "most likely a bug in the database driver, for some reason code works when this variable is added".

      The bug was found with cppcheck (open source static analyzer for C and C++). I recommend people trying it or any other static code analyzer, as those are pretty good at finding there easy errors that are hand to see with eye.
      http://cppcheck.sourceforge.net/

    10. 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
    11. 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.
    12. 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.
    13. Re:Developers or Managers? by Anonymous Coward · · Score: 0

      Considering software maintenance often costs more than its primary development, you're completely wrong. Add to that that using better development practices will actual speed up development and you're doubly-wrong. There are research/studies about these things. Go read them.

      Fix your bugs by not writing them in the first place. Your ROI will massively improve. Stop confusing lack of skill with other things.

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

      That's also a simplistic view. We could argue that safety is just as important in your living room as in a construction site or a military warzone because you could be attacked in your home or a rock could fall from the sky through your ceiling. But the fact of the matter is, you aren't going to be spending your days wearing a hardhat, bullet-proof vest, and holding a mine detector while you're watching Netflix.

      Security is always important. Sometimes it's more important than others. Realistic threat assessment is important.

      In your case you seem to have been talking about a software media player on a desktop or smartphone which can be leveraged to perform non-media-related actions and interferes with non-media activity, but I think the GP was talking about a physical media player device.

    15. 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
    16. 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
      /)
    17. 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.
    18. Re:Developers or Managers? by Anonymous Coward · · Score: 0

      But your business will also fail if you never get a second contract from any of your customers, because the quality of product on the first contract was so low.

      This is the common short-term focus that so many managers have. I saw it in most of the companies I worked at in my software career. Most of those companies don't exist anymore.

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

      Head of Windows 10 Development, is that you?

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

      Usually the problems caused by the faulty code are infrequent enough that they can afford it. An occasional crash? Restart program. An occasional database corruption? Load backup. Occasional hack? Banks issue new credit cards and cancel old ones.

      There are very few examples where infrequent errors seem like they need fixing from a cost-benefit perspective. Security is perhaps one area which should have more attention paid to it, but most people don't see the benefits of putting the effort into fixing these problems.

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

      You did not understand their point. It costs more to produce good C++ than good Python, Java or Kotlin. Pick the right tool for the job. Corollary: own more than one tool.

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

      If the language allows for instructions that are insensitive to hardware limitations, or the language is insensitive to coding outside what is intended (I'm guessing nobody wants buffer overflows) the either the compiler should throw warnings or errors, if not that language should be replaced with something that better follows intentions.
      To explicitly have to code around hidden weaknesses, while possible, obviously raises the question how economical the old C is.

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

      Ever heard of Microsoft?

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

      Tell that to Microsoft.

    25. 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
    26. 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
    27. Re:Developers or Managers? by Anonymous Coward · · Score: 0

      You make an excellent point and while in the basis that is correct, current economic pressure rewards short term vision and not long term vision. Stakeholders will 'make their buck' before technical debt catches them up.

      Many companies went under, while making a lot of 'short term' profit. With the way market operates these days, this will become an increasingly often occurrence.

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

      Companies that collect data should be held accountable for that data, but many of them are collecting data that is publicly available. A credit agency is a contributory organization where they get data from businesses, but that is only a small part of the data these companies have. No business has to provide data to a CRA so if you're concerned about pressuring the credit agencies, start by putting pressure on the businesses themselves. Cancel any lines of credit you have with them and tell them you don't trust your information at a CRA. If businesses stopped contributing and decided to take on the burden of credit risk themselves, that would have an impact. But don't hold your breath.

        I recently received an email from some firm called Persistent Systems & Accelerite Markting that I've never heard of telling me they collect my data for marketing purposes and I needed to request opting out if I wanted to, but that they had a legal right to collect the info. The email came to my work email (where I've only been for a couple of months) so my guess is they scraped LinkedIn to get it.

      Shouldn't the bigger question be why so many data aggregation firms exist that are able to do so without any approval or acknowledgement by you? If I engage in a financial transaction and need credit then I'm accepting the fact my information goes to a CRA but when I search for my information via Google why should I get back dozens of hits from "public data records aggregaters" when I never authorized any such information? I've seen sites that had my current and previous addresses, land line phone number (that I paid to have unlisted), family members, etc.

      Start by shutting those down and placing stricter burdens on the contributory systems.

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

      You have no fucking idea what you are talking about, moron.

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

      And if you are trying to make your program in another language that is not fit for the task, you are increasing costs as well, more specifically, you will hit a wall and cost will just balloon at the point where you are 98.99% done and stuck there forever.

      If 'you' are using an idiot's language because you cannot properly deal with safety when required, 'you' are increasing cost.

    31. 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.

    32. 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.

  5. 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 Anonymous Coward · · Score: 0

      Problem is some do blame it, thus Ai driving. It's astounding the number of people in IT who completely dismiss domain experts for stackoverflow. That is, people who know what the fuck they are doing over those who spend all day stealing code. Sites like stackoverflow should be for reference not taken verbatim.

      Article is clickbait, nothing more. There are plenty of languages out there for inexperienced developers, might want to "go" pick one of them.

    4. 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?
    5. 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.

    6. 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
    7. 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.

    8. Re:It's not the language, you stupid jackwagons... by Anonymous Coward · · Score: 0

      But there comes a point when you ban the tool in a particular setting...no quadruple-trailers on the interstates...

    9. 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
    10. 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.

    11. 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!

    12. 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.
    13. 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.

    14. 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.

    15. 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
    16. 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
    17. 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.

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

      It is the language stupid. Don't use unsafe languages willy nilly.

      Entire classes of errors disappear when a better language is used.

      Let's expand this. If you give the Assembler and let's say ML (as in OCaml, SML/NJ), a much safer language, to equally clever and experienced programmers, they would NOT make the same number of mistakes. But of course, ML programmers will make fewer errors for the same effort.

      We all agree with this. No one in the right mind will say BASIC or COBOL are good languages. No one will suy, the language does not matter, we still can produce good artifacts with those. We all agree that there are better ways to do things than in BASIC or COBOL. But C++ programmer's logic shuts down when the very same criticism is directed to their tool.

      Programmers are notorious for not understanding human factors (they scoff at users who cannot understand their programs and refuse to accept that they failed to design in an intuitive way from the user's standpoint, not the lower level technology standpoint), even when they themselves are the users. To become good at ANY language, it takes YEARS of experience. However, this extensive investment in the tool clouds judgment when the said tool in fact sucks by any usability metric.

      It is not about being close to the metal. We can absolutely generate the exact same close-to-metal code with a much better language like Rust, as you can with C++. In fact Rust has more information from the source to do LESS checks in the generated machine code.

      We don't need to lose any of the power of C++. And we can do better than Rust if we first admit that we currently do things in an unsafe way that should never be allowed in any code that comes into contact with potentially malicious parties.

      This is like the for loop. Yes, a GOTO is more faithful to the instructions in the metal. But let us admit that ALL humans (not just everyone else except you - a delusion) suck at keeping track of instruction jumps.

      Cognitively speaking, our working memory sucks. Any tool that expects us to just be disciplined is a recipe for disaster.

      By all means code your video games in C++. No big deal. But don't let C++ or C touch any network code at the least.

    19. Re:It's not the language, you stupid jackwagons... by Anonymous Coward · · Score: 0

      Still the same. You're just randomly choosing a target without ensuring it *is* a target. Still not the language.

    20. Re:It's not the language, you stupid jackwagons... by Anonymous Coward · · Score: 0

      Your claim is faulty. The Linux kernel is written in C and large chunks of it look like hand-re-implementing C++. While it has had a few security holes, the only non-exotic ones in years have all been null pointer de-references*. All other ones have been so far one-off that there's no class of bugs to defend against anymore.

      stack buffer overflow, nope!
      heap buffer overflow, nope!
      file format parsing bug (1)
      structure parsing bug (1)

      * They all take this form of a ridiculous API sequence results in calling a null, which is in immediate security hole for reasons, but even if it were not would crash the kernel.

    21. Re:It's not the language, you stupid jackwagons... by Anonymous Coward · · Score: 0

      No.... C still shoots you in the very foot you told it to. Just because you don't understand what you said is not C's problem.

    22. 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.

    23. Re:It's not the language, you stupid jackwagons... by Anonymous Coward · · Score: 0

      "But 18 wheelers *are* awkward, and regularly kill cyclists and pedestrians because they have awkward mirrors that are painful to use"

      Many such accidents are due to pedestrians and cyclists not paying attention to the fact that their's a massive truck turning a corner and looking out for their own safety. But we live in a society that likes to make everyone a victim. We no longer believe that there's such thing as personal responsibility.

    24. Re:It's not the language, you stupid jackwagons... by Anonymous Coward · · Score: 0

      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.

    25. 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.

    26. 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.
    27. 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.
    28. 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.
    29. Re:It's not the language, you stupid jackwagons... by Anonymous Coward · · Score: 0

      Even very experienced programmers working for capable organizations write vulnerable C/C++ code. It's very hard to get right (especially when you're concerned about the dozen other aspects of the program that are also hard to get right). Use a different programming language and *woosh* all of these problems disappear because they are either checked by the compiler or at runtime.

    30. 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.
    31. 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.

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

      COBOL actually is a *good* language. It is only out of fashion. It is probably the best language for text input/output where formatting is complicated.

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    33. 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".

    34. 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.
    35. 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.

    36. 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.
    37. 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.

    38. Re:It's not the language, you stupid jackwagons... by Anonymous Coward · · Score: 0

      To take the 18-wheeler analogy further, real world 18-wheelers meet stringent standards for the quality of e.g. their brakes. In the C++ world, each truck driver has to improvise their own brakes, or cross their fingers and hope they don't need to use them.

    39. 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.

    40. Re:It's not the language, you stupid jackwagons... by Anonymous Coward · · Score: 0

      That doesn't seem to be a good counterexample: that was code that wasn't self-explanatory.

      I find myself telling people to remove worthless comments from the code because it trains people to ignore worthwhile comments. Too much: // loop 5 times
      for (int i = 0; i 5; i++)
      { // Add the n and n-1 element, and store in n-1.
              Products[5-i-1] += Products[5-i-1];
      }
      int SumOfProducts = Products[0];

      That comment should be something more like "sum all numbers in a 6 element array by adding n to n-1 and storing the result in n-1, for all 1 n 6, starting from the highest n".

      This is a contrived example, though, it should be rewritten to be clearer still, maybe use an accumulator variable, maybe MapReduce. There could be a line that looks something like this:

      int SumOfProducts = Sum(Products);

      That doesn't really need a comment at all. The interior of the "Sum" function might. And maybe you use mapreduce or whatever you want as the implementation detail of Sum.

    41. Re:It's not the language, you stupid jackwagons... by Anonymous Coward · · Score: 0

      Some of them allow FOSS projects to use them for free. There's at least one I've seen which required a github URL as evidence it was FOSS to avoid it being abused. It's good for them to do so - there generally isn't budget for them as you say so it isn't a lost sale but it does make more people familiar with them so it's more likely they'll be recommended, purchased and used within business.

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

      Code tells you HOW,
      Comments tell you WHY.

    43. 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.
    44. Re:It's not the language, you stupid jackwagons... by Anonymous Coward · · Score: 0

      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.

      Valgrind has come a long way over the years. The other day I was screwing around with it and it kept flagging all kinds of calls for uninitialized memory use. It was obviously whacked in the head yet the reason for it was actually quite impressive. The calls were side effects of RNG use in TLS stack being tracked deep into the application code where they were finally evaluated where only then is the alarm triggered. I was amazed it was able to do that especially considering it was an optimized production build with no debugging. So much so that I reran the same test in the clear just to make sure.

    45. Re:It's not the language, you stupid jackwagons... by Anonymous Coward · · Score: 0

      Thank you for this, I feel like this thread is a case study in the Dunning-Kruger effect. It is basically impossible to write secure software in C/C++ in anything beyond a few hundred lines. Engineers have to plan for the sad truth that they will mistakes. C++ is a language that makes every trivial mistake fatal.

    46. 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.

    47. Re:It's not the language, you stupid jackwagons... by Anonymous Coward · · Score: 0

      Also UBSAN, better for quite some things.
      Debug mode of libstdc++.
      Also Coverity is free for OpenSource projects (at least it was last I checked).
      There are probably more tools you can use than you have time to.

    48. Re:It's not the language, you stupid jackwagons... by Anonymous Coward · · Score: 0

      I'm not sure if you've ever used anything other than valgrind. The proprietary tools do more to look at intent. Code like

          memset( &portal, 0, sizeof( portal ) );
          portals.Append( portal );

          memset( &cluster, 0, sizeof( portal ) );
          clusters.Append( cluster );

      copied from PVS-Studio example on Doom 3 source

    49. Re:It's not the language, you stupid jackwagons... by Anonymous Coward · · Score: 0

      Any functional language.

      Next!

    50. Re:It's not the language, you stupid jackwagons... by Anonymous Coward · · Score: 0

      Exactly this. While unusual, it is sometimes necessary to shoot off a foot. (Gangrene?) C does what you tell it to do, and don't try to second-guess.

      Writing good C code is not hard, there is no problem in using C. It is a fast minimalistic language. If you want to, there are bounds checking libraries you can use during development/testing.

      Note that a Java program stepping outside an array is not better off than a C program stepping outside an array. The C program may then corrupt memory - which may or may not be discovered immediately. The Java program will crash or throw an unexpected exception - which also disrupt whatever it is doing in production. A company that doesn't have the time to test its C softtware, surely don't have time to handle every exception a Java program conceivably could throw. Their devs probably don't even know all these exceptions.

    51. 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.

    52. Re:It's not the language, you stupid jackwagons... by Anonymous Coward · · Score: 0

      In a memory-safe language, they just screw up something else with pretty much the same result.

      Impossible in Functional languages. The worst you contend with are space leaks and thunks.

    53. 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.
    54. Re:It's not the language, you stupid jackwagons... by Anonymous Coward · · Score: 0

      As a SKILLED user of C++. C++ is perfectly damn fine and it does EXACTLY what it is supposed to. It isn't particularly hard to use. It's actually very elegant. It just has a learning curve. The mirrors are hard to check if you look out the window but there's a button on the side that pulls up a screen on your dash showing the view from the camera attached to the mirrors. The mirrors are just there because C had them.

      The real problem is that C is pushed to new coders in university and etc. But they do a terrible job of teaching it. Exactly the inexperienced type of person you DON'T want working on manual memory.

      Learn easy languages first, then move to more advanced ones like C and finally C++.

      C++ is like driving a manual. An experienced manual driver isn't going to have any difficulty with it. But everyone is pushed to drive manuals (C) and then we have people complaining about the manual drivers. Learn to drive the automatic first, then the manual. A manual shouldn't be what you start out driving on your first try.

      There is plenty of great resources on how to use C++ properly. The problem is all the garbage on the internet and books from academia that teaches you incorrectly. C++ is not a good fit for blind usage because it requires a certain level of understanding to use correctly. And they keep telling people to do bad shit. No wonder we have so many bad C++ programmers.

      I put the blame on the university system for not understanding what makes a "good" C++ programmer. They focus on very basic concepts like for loops and if statements, without covering anything more advanced that the most basic building blocks of structure. The problem is that you NEED to understand much more than that. You need to understand constructors, iterators, templates, RAII, references, operator overloads, rvalue/lvalue etc. to use C++ properly. But university thinks that all programming languages are interchangeable (they aren't) and so they only teach the "universal" bits. The problem is that those are the bits that aren't intended to be used in C++ except for composing more abstraction layers.

      Nobody who just understands the basics of C++ should be programming in it in a production environment. Anyone who thinks C++ is "too complicated" and you should use "a subset of C++" IS THE PROBLEM. If you want a simple language, use a simple language. If you want efficiency, you MUST be prepared to deal with the complexity that is involved.

      Programming in C++ is all about nested abstraction. It doesn't lend itself to Java style coding and isn't intended to be used that way. To compose abstractions in the way C++ does requires many layers. If each layer had a 10% overhead it would quickly spiral out of control and the overhead would be insanely huge. Hence the 0 overhead principle. In C++ I can have 20 layers of abstraction and the code runs at the same speed it would have without the layers of abstraction. Used properly, this allows me to write code that is faster with less bugs. In languages like Java, you can't nest abstraction that much because it involves a lot of overhead, whereas C++ does the same thing with no overhead. So C++ code ends up being "faster" in practice because we can handle more complex structures in it without losing efficiency. It requires discipline that is lacking in many individuals, but C++ isn't the problem, its users are.

      C++ is less buggy when used correctly, references and pointers are necessary to ensure that the code remains less buggy. C++ is a power tool intended for doing important shit. Not a toy. Don't give power tools to children.

    55. Re:It's not the language, you stupid jackwagons... by Anonymous Coward · · Score: 0

      and nobody needs to go around blaming C/++, either

      except for rust developers, who need to pay for negative PR campaigns to promote their own flawed alternatives.

    56. Re:It's not the language, you stupid jackwagons... by Anonymous Coward · · Score: 0

      Hahahah "she", hahahah :_D She's coding in a pseudo-low level language, hahahah :_D "She", hahahaha :_D

    57. Re:It's not the language, you stupid jackwagons... by Anonymous Coward · · Score: 0

      I found valgrind a bit difficult to learn. Instead I found that running core dumps collected from live systems and running it through gdb was a better option in the sense that it allowed me to eliminate the bugs that were actually crashing the application while it was in use. Just my two cents worth.

    58. 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.

    59. Re:It's not the language, you stupid jackwagons... by Anonymous Coward · · Score: 0

      "doesn't it become almost necessary to use languages that ensure the programmer can't blow his/her own foot off?"

      There are none.

      Those that limit the programmer also limit the solutions that can be created.

    60. Re:It's not the language, you stupid jackwagons... by Anonymous Coward · · Score: 0

      Your bounds checks that you call a "non-issue these days" is why you need a a multi-core >2 GHz CPU for something that ought to be able to run on a Z80 if it was written decently. Learn how to use a memory profiling tool or go home! Quite frankly, C/C++ is manageable until you try to be "fancy". And guess what, your managed languages their runtimes and libraries also contain errors, and they are often a whole lot more complex than a simple program. By your argumentation we'd have to write everything in Ada with draconian compiler directives.

    61. Re:It's not the language, you stupid jackwagons... by Anonymous Coward · · Score: 0

      Great.

      The same argument can be made for every other language out there, including the higher level ones.

      Instead of invalid pointers or buffer overflows you get eval and deserialization exploits.
      When we no longer have things like SQL injections (Yes, SQL is a high level language.) we can pretend that higher level languages solves the issue with programmer mistakes.

      If you want bug free software without exploits then code according to the rules set up in ISO 26262 or IEC 62304.
      It is time consuming and expensive, but if you follow the rules you get very stable code.

    62. Re:It's not the language, you stupid jackwagons... by Anonymous Coward · · Score: 0

      One day there will be a legal requirement for cyclists to be at least partially sane, but don't hold your breath.

    63. Re:It's not the language, you stupid jackwagons... by Anonymous Coward · · Score: 0

      What if the mirrors get in the way of seeing where the hell you're going? That's Rust/Swift/every other "safe" language recommended by OP.

    64. Re:It's not the language, you stupid jackwagons... by Anonymous Coward · · Score: 0

      No, in other words - A bad tradesman blames his tools.

    65. 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."
    66. 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.

    67. 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.

    68. 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.

    69. Re:It's not the language, you stupid jackwagons... by Anonymous Coward · · Score: 0

      What language would that be, exactly, for your example usage in embedded systems?

      I don't have an answer for that or I might have moved on. There are only compromises as far as the eye can see.

      Rust is promising, but would you really propose using it right now for the kind of work you're doing?

    70. 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.

    71. Re:It's not the language, you stupid jackwagons... by Anonymous Coward · · Score: 0

      Apparently someone with mod points has confused "insightful" with "moronic".

    72. 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.

    73. 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
    74. Re:It's not the language, you stupid jackwagons... by Anonymous Coward · · Score: 0

      That's because 18 wheelers are fairly easy to drive, there are no huge issues with them when the user is trained to operate them.
      C++ is more like aircraft, or a large piece of industrial machinery. Pilot or operator error is often cited in crashes or industrial accidents, but just as often it's found that the design made failure inevitable. The controls for commercial aircraft are often modified to fix fundamental issues with the affordance they provide the pilot. It should be easier to operate the craft correctly than incorrectly, and incorrect operating modes which may be used in specific scenarios should provide instant feedback detailing how to return to a correct mode. It's the same with industrial machinery. Before safety standards people would dance between running belts and blades, with disastrous results. But today industrial accidents are rare, because we've removed the human from the dangerous working bits through considerate design.

      C++ is like an aircraft operated by moving a thousand levers to the right spot. It's a machine with no limits, covers, or safety devices. You can do whatever you want basically whenever you want, and the language makes it extremely easy to shoot yourself in the foot. Nobody wholly understands the spec, but you must know it to write flawless code. It's an unmitigated disaster of a language, and should only be used by sage experts who mediate on each line written for hours. Seriously. If you want to bang out some useful software in a reasonable amount of time, use a managed language. C++ is for when execution time is more important than developer time by an order of magnitude or more, which is almost never the case.

    75. Re:It's not the language, you stupid jackwagons... by Anonymous Coward · · Score: 0

      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 is just that - you can't rely on it to do *anything*, even if you think you understand what your machine will do. Modern optimizing compilers can give some very unexpected results if your code exhibits undefined behaviour.

    76. Re:It's not the language, you stupid jackwagons... by Anonymous Coward · · Score: 0

      We no longer believe that there's such thing as personal responsibility.

      Just look at the political party that constantly claims to be the party of personal responsibility and based it's entire platform on fear and being the victim for the past 40 years.

    77. Re:It's not the language, you stupid jackwagons... by Anonymous Coward · · Score: 0

      > No! Undefined is just that - you can't rely on it to do *anything*

      This is why "undefined" should be read as "don't do this!"

      If you're relying on the peculiar behavior of a specific compiler to interpret undefined constructs, you're "not even wrong!"

    78. Re:It's not the language, you stupid jackwagons... by Anonymous Coward · · Score: 0

      Look I understand your frustration with C/C++ but the way things are done is done that way for a reason.

      Yes, cyanide is dangerous, but we still use it for industrial processes because it is useful.

      Maybe C and C++ are used in instances where it shouldn't be, but that's an argument you need to make about individual programs and not the language as a whole.

  6. Your face has a serious problem. by Anonymous Coward · · Score: 0

    Someday we'll get rid of C and replace it with JS and boot to browser instead of desktop! over my cold dead motherboards!

  7. 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 Anonymous Coward · · Score: 0

      This is such a bullshit argument. As far as I can tell no one is saying to replace C with python.
      Just make the fucking C compiler give you an error when you go out of bounds.
      Give a pointer type with length that can be enforced by the compiler, so I don't have to write the length checks myself.

      Programming is about automation, and I don't see why wanting to automate this kind of stuff is always seen as an attack on C.

      Yes, anyone can make a struct {void *ptr; unsigned long length;};
      but you only have to forget the length check once, while having support in the language will make sure you never forget.
      Doesn't even have to be a language feature, just make it a compiler extension.

    3. 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.

    4. 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

    5. 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.

    6. Re:With great power comes great responsibility! by Anonymous Coward · · Score: 0

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

    7. 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.

    8. 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.

    9. Re:With great power comes great responsibility! by Anonymous Coward · · Score: 0

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

      Wow. That's a bit on the nose, isn't it? I mean, you can't expect every manager of every hardware or software firm everywhere to spend time and money actually setting up programing standards for his company, and even more time and money looking for, vetting, and hiring trained professionals who are already experts in c/c++ and are capable of adhering to the standards set forth by their organization.

      Just do what every manager does: take some poor slob you already have on staff and who probably might know a little about C/C++ and make them responsible for the whole thing. Once the company writes up the paperwork that El Slob-O is the official C/C++ "lead programmer" then all the mistakes are his problem and not theirs.

      To all the programmers out there: If you take the position to write the code, you'd better be able to follow through.

      To all the managers out there who want things done but don't want to spend the money or time: don't be shocked when your poor slob of a Python programmers tells you he doesn't know C/C++ and won't do the work.

    10. 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."
    11. 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.
    12. Re:With great power comes great responsibility! by Anonymous Coward · · Score: 0

      Python is so pure... until you pip -v and actually look at what's behind the modules. Yep, it's a bunch of C and C++ (and a significant amount of good old fortran). Or at least that's what I've been seeing the last few days as I fight dependency hell to get someone else's python code to work!

    13. 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).

    14. 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.

    15. Re:With great power comes great responsibility! by Ichijo · · Score: 2
      --
      Any sufficiently unpopular but cohesive argument is indistinguishable from trolling.
    16. 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'
    17. Re:With great power comes great responsibility! by Anonymous Coward · · Score: 0

      Now, you wanna talk about crazy... crazy is relying on any distinction between two characters when it's literally impossible to see the difference.

      The tab key is for telling your editor to auto-indent (using spaces). Tabs should never be written to disk.

    18. 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.
    19. 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.
    20. Re:With great power comes great responsibility! by Anonymous Coward · · Score: 0

      *Any* kernel needs assembly language or compiler intrinsics that are basically equivalent of assembly. How else you can write efficient locking primitives for target cpu?

    21. 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..

    22. 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.

    23. 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.
    24. 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.
    25. Re: With great power comes great responsibility! by Anonymous Coward · · Score: 0

      That is to do with msdos rather than borlandc, and the location of a video card, and should have a length of 65536 bytes i suspect. Unsafe pointers where needed could simply have overlapping sizes.

    26. Re:With great power comes great responsibility! by Anonymous Coward · · Score: 0

      "You can write an OS in any language."

      No, you can't.

      You can't in Python, or Java (barring only the JVM being directly implemented in the hardware).

      The interpreter becomes the kernel, and that can't be written in the language, obviously because the language requires the interpreter to interpret the language...

    27. Re:With great power comes great responsibility! by Anonymous Coward · · Score: 0

      No language can replace nor avoid the necessity of understanding what you are doing. It will not replace thought but may introduce other obscure bugs (which the unfortunate maintainer will resort to unchecked_conversion type primitives to gain the functions he needs.
      Think of C as basically an assembly language recast into a compiler, and losing control of some machine details for which very elaborate workarounds (in assembly language generally) need to be invented.
      If assembly language were portable across machine architectures, C might never have appeared.
      Some forget btw that unix was first written for an 18 bit machine with maybe 8K words memory...in assembly language.

    28. 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).

    29. Re:With great power comes great responsibility! by Anonymous Coward · · Score: 0

      as opposed to something like Python where you have to work to make it unsafe

      Not very hard.

      at least in terms of the type of vulnerabilities the OP is addressing.

      Oh.. OK.

    30. Re:With great power comes great responsibility! by Anonymous Coward · · Score: 0

      I believe Rust was one of the languages listed in TFA. https://os.phil-opp.com/

    31. Re:With great power comes great responsibility! by Anonymous Coward · · Score: 0
    32. 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.

    33. Re:With great power comes great responsibility! by Anonymous Coward · · Score: 0

      And the poor performance of that operating system is the only thing that keeps me using the major competing OS in that space. It's not for love of Apple, but rather an intolerance of poor performance. I would have given a kidney for Google to have written it in C or C++ instead!

    34. 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.
    35. 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.
    36. 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.
    37. 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.
    38. Re:With great power comes great responsibility! by Anonymous Coward · · Score: 0

      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 ?

      Sure, if your compiler supports inline assembly. But your Java fantasy land has nothing to do with actual Java.

    39. 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.
    40. 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.
  8. 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".

  9. 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.

  10. 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 Anonymous Coward · · Score: 0

      Yes, memory words have rights dammit!

    3. 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.
    4. 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.

  11. Misses the point by Anonymous Coward · · Score: 0

    Itâ(TM)s possible (easy?) to write crap code in most languages. The problem is with the workmen not the tools.

  12. 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: 0

      And if you're not still learning, you're either 6' under or in a memory care unit.

    5. 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...

    6. 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.
    7. Re:Quote From The Article by Anonymous Coward · · Score: 0

      You can expect it to crash and expect to figure out why and learn from it. Not a case of one or the other.

    8. 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.

    9. 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.

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

      In a professional environment your program will crash from time to time while developing it; even the best of us make stupid mistakes once in a while, that's what things like code reviews and QA are for.

    11. 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
    12. Re:Quote From The Article by Anonymous Coward · · Score: 0

      This reminds me of the UW (Washington) Comp Sci professor who had publicly available classes on C++ on the local cable channels. Every so often he would go on and on about how a certain software company in Redmond had programmers who were the worst C++ programmers on the planet.

      Ironically at the time, most of the UW Computer Science programmers were going to work for said company. Sooo, the crappy programmers had been taught how to code in C++ were trained by the very same person who said they were crap. He never did make the correlation that he was one of the sources of crappy code practices he complained about.

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

      Right tool for the right job. My favourite golang usually just works after passing compile. It's safe by default.

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

      Yeah, it 's not "crash"; it's "core dump".

  13. 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 Anonymous Coward · · Score: 0

      That's a whole lot of "probably". In C they could also probably just have checked the length of the payload. Strange thought, I know!

    3. 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.

    4. Re:Not this again by Anonymous Coward · · Score: 0

      On the flip-side, if it were written in Go it'd have never been widely used either because it's not yet a practical language for most software or because its performance characteristics are unsuitable for many of the implementations presently employing openssl.

  14. 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 Anonymous Coward · · Score: 0

      Some say C is unsafe at any speed...

    2. Re:Get good developers if you need C/C++ by Anonymous Coward · · Score: 0

      Compared to some other language that are only unsafe when they run slow, simply because they can't run fast.

    3. Re:Get good developers if you need C/C++ by Anonymous Coward · · Score: 0

      Then some are stupid.

    4. 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++.

    5. Re:Get good developers if you need C/C++ by edtice1559 · · Score: 1
    6. 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.
    7. Re:Get good developers if you need C/C++ by Anonymous Coward · · Score: 0

      There are probably some C++ programmers who think that way, but in my experience, many of them are just being practical.

      Rust isn't mature enough for a lot of the new software that is written in C++, and it was even less-so in the past. Additionally, Rust comes with its own downsides - enormous binaries being a bit of a showstopper in the embedded world. Rust shows promise, but to suggest that any C++ developer who hasn't jumped on the bandwagon is an elitist fool, that's just delusional.

    8. 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?

  15. 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 Anonymous Coward · · Score: 0

      I think what people may be running into is a problem where a system uses C/C++ and there is another system that uses something else and someone wants to keep low level stuff separate from high level stuff and nobody can agree on how/why. This is not a problem for certain kinds of projects but other kinds of projects might have even more software that is also using different combinations of low/high level code. The conversations are all âoewhy canâ(TM)t you just do this...â instead of âoehere is my problemâ. The problem often is about use cases or UI or something else and not really about how to avoid low level code

    2. Re:Not a buffer overflow by Anonymous Coward · · Score: 0

      The Internet has a Huge Clickbait problem and Developers Don't Want to Deal With It.

    3. 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
    4. 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...

  16. 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 Anonymous Coward · · Score: 0

      Proof that security errors can be created in any language, including English.

    3. 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
  17. #killallcpp by Anonymous Coward · · Score: 0

    That does it! We need to do away with all of this memory privelege C++ has, it's very problematic. Clearly C++ developers have a problem and they do not want to face it. It's up to us latte drinking node.js worshipping pink haired flufferkin to sort this out! Quick my easily offended bretheren, to the waahg-mobile!

  18. Fuck vice by Anonymous Coward · · Score: 0

    We all know what a buffer overflow is, this pap doesn't belong on slashdot.
    I know what some of you are thinking: "chop off your dicks and use Rust already you stupid nazis"

    1. Re:Fuck vice by Anonymous Coward · · Score: 0

      > I know what some of you are thinking: "chop off your dicks and use Rust already you stupid nazis"

      Verbatim.

  19. 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.

  20. 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 Anonymous Coward · · Score: 0

      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.

      We must have read that differently. I read it as "when I was learning to program, it was expected that my programs would crash". I would be shocked at any new programmer's programs not crashing. That's part of the learning process.

      By they time we're talking about hiring a programmer, I would expect finished products to not crash, but during development? Certainly. Even an experienced programmer will miss things during development. That's the stuff that should never leave the cubicle, though, stuff that should have been caught and eliminated before release.

    6. 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++.

    7. 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.

    8. 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.
    9. 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.
    10. 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?

    11. 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.

    12. 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.
    13. 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.

    14. Re:Ad for Rust (author's employer) and Swift by Anonymous Coward · · Score: 0

      They should check out Fortran. No memory management at all, thus much safer.

    15. 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.
  21. 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
  22. 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.
    2. Re: python cant solve all the problems. by Anonymous Coward · · Score: 0

      I suspect he wasn't talking about a DSPIC 16 but the truly tiny series that's actually used in coffee makers. https://www.microchip.com/desi...
      I kinda doubt micropython would fit. ASM often relies on using otherwise unused bits in registers as ram. It gets pretty tight in there.

    3. Re: python cant solve all the problems. by Anonymous Coward · · Score: 0

      That doesn't run on a pic16.

  23. 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 Anonymous Coward · · Score: 0

      > It mostly seems to be used for novel standalone utilities, which are not parts of larger projects.

      That's interesting that you think that, considering it was developed specifically to replace sensitive libraries that Firefox uses and in general seems to be targeted at being binary compatible with C for the purposes of securing libraries without breaking compatibility with applications designed on top of them.

    2. 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.

    3. 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.
    4. Re:Article is longer than the clickbait title by Anonymous Coward · · Score: 0

      Mozilla is fucking batshit insane. Just ignore them.

      Rust has not matured to the point that I would consider using it. Maybe in 10 years, but C++ is also maturing, so it has to keep up. C++ is ahead in the race and I don't think Rust will catch up anytime soon.

      I think Rust just might be better than C though, but many C programmers just prefer it because it is simple.

  24. 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.
  25. Re: It's not the language, you stupid jackwagons.. by Anonymous Coward · · Score: 0

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

  26. Why do we still get more bug in Java and Python? by Anonymous Coward · · Score: 0

    "memory safe" + shit coders = shit software....

  27. 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 Anonymous Coward · · Score: 0, Interesting

      Try Rust.

    3. Re:Not overblown by olsmeister · · Score: 5, Insightful

      B)
      ____1) Experienced programmers are expensive.

    4. 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.

    5. 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.

    6. 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.

    7. Re:Not overblown by Anonymous Coward · · Score: 0

      E) Tools that require the programmer to catch 100% of a known problem with known solutions are bad tools

      Says someone who'd hit his own thumb if given a hammer.

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

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

    9. 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.

    10. 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.

    11. 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.
    12. Re:Not overblown by Anonymous Coward · · Score: 0

      Profit!

    13. 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
    14. 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.
    15. 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.

    16. 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.
    17. 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!
    18. 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.

    19. Re: Not overblown by Anonymous Coward · · Score: 0

      Aw, Snowflake! Show us where the nasty SJW triggered you!

    20. Re:Not overblown by Anonymous Coward · · Score: 0

      which cost?
      https://www.electronicdesign.com/embedded-revolution/ada-language-cost-savings

    21. Re:Not overblown by Anonymous Coward · · Score: 0

      I guess you're talking about myth number 2. Yes, myth.
      https://www.electronicdesign.com/dev-tools/11-myths-about-ada

    22. 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.

    23. 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?
    24. Re:Not overblown by 0100010001010011 · · Score: 1

      Have a well defined military specification.

    25. 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.

    26. 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."
    27. Re: Not overblown by Anonymous Coward · · Score: 0

      In C++ you can write quite safe code by not using some language features, but you need a tool to check that in the codebase to be sure.

    28. 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.
    29. 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'
    30. 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.

    31. Re: Not overblown by Anonymous Coward · · Score: 0

      Itâ(TM)s a problem with an easy fix at the compiler level, treat all code as having safety. If the code compiled but ultimately allows for violating that safety (one reason C is fast is that there are no sanity checks) because a variable allowed for asking for unsolicited memory, the C or C++ runtime should break the program unless itâ(TM)s on the debug runtime in which case it needs to point to the actual function that is overflowing and not the function that blew up because it recurved the overflow.

      In MSVC, this happens quite a bit, where some memory safety is ignored because of a missing sign bit or a 32bit value as cast to 64bit, so instead of asking for the 65535th entry it asks for -32767 which doesnâ(TM)t make sense.

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

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

    33. 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.

    34. 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.

    35. 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.

    36. Re: Not overblown by Anonymous Coward · · Score: 0

      It is close though. Performance is terrible.

    37. Re: Not overblown by Anonymous Coward · · Score: 0

      Exactly, these security holes arenâ(TM)t created by C/C++, but how the underlying hardware works. When you use a so-called âoememory safeâ language, you are simply offloading the responsibility to another developer, because the memory must be managed at some point. The developers of Java, Python, etc are only human, and there are sometimes memory management related bugs in these code bases (I just found one in Python last week).

    38. 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

    39. Re: Not overblown by Anonymous Coward · · Score: 0

      Master the compiler them mess it like a lion

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

      More like 5, or 8 counting the abstract versions.

    41. Re: Not overblown by Anonymous Coward · · Score: 0

      Or lint your code

    42. 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.

    43. 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.

    44. 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.

    45. 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.

    46. 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.
    47. Re: Not overblown by Phil+Urich · · Score: 1

      Username/comment synergy, right here.

      --
      I remember sigs. Oh, a simpler time!
    48. Re: Not overblown by Anonymous Coward · · Score: 0

      How would you access OS interrupts and the like without C?

    49. 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
    50. 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.

    51. Re: Not overblown by Anonymous Coward · · Score: 0

      Bad orange man said mean things that made me feel unsafe.

    52. Re: Not overblown by Anonymous Coward · · Score: 0

      Rust is relatively safe compared to Golang. Of course, Ruby claims the most purple hair people.

    53. Re: Not overblown by Anonymous Coward · · Score: 0

      Get it straight.

      C was not build for common programmers. It was written for operating system. A better assembler.

      If you want to write a business language use a business language. COBOL was designed for business. Fortean for science and math. RPG yes that is language too.

    54. Re: Not overblown by Anonymous Coward · · Score: 0

      Rust is for faggots, feminists, and the sexual predators who think virtue signaling will make the former fuck them.

    55. Re: Not overblown by Anonymous Coward · · Score: 0

      All the cool kinds are using it

    56. Re: Not overblown by Anonymous Coward · · Score: 0

      Go is likewise burdened under the tyranny of a corporate social just-us CoC.

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

      It's not.

    58. 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.

    59. 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.

    60. 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.

    61. 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.

    62. Re: Not overblown by Anonymous Coward · · Score: 0

      What language would you use to write an OS in?

    63. Re: Not overblown by Anonymous Coward · · Score: 0

      Or working with loops where the range of the variable components are known, check the range at the start of the loop.

      This is a very simplistic compiler optimization. Itâ(TM)s extremely common on JIT compilers that are reducing branches. When you compile a context (basically whatâ(TM)s between curly braces) try to compile as though the context is sealed. You can then check which arrays, lists, etc... are accessed and perform relevant checks at the start of the context. If you can trace that variables remain constant between additional nested contexts, the bound checks can be moved to lower nesting levels.

      Youâ(TM)ll find that this can very easily produce safer and faster code than hand optimized assembly because the bound checking can be placed in optimal positions with the pipeline and even contribute to reduction of branch misses.

    64. 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.

    65. 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.

    66. 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.

    67. 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.

    68. 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.

    69. 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.

    70. Re: Not overblown by Anonymous Coward · · Score: 0

      This.

      Your compiler must be backwards compatible. C++ is starting to lose this trait, which is an issue, but the issue is mitigated by most compilers supporting multiple versions of C++.

    71. 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.

  28. 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
  29. Re:Overblown by Anonymous Coward · · Score: 0

    COBOL, FORTRAN VB, Java, Pascal even, they all return an index error, "out of range" or something similar.

    WTF with C?

  30. 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 Anonymous Coward · · Score: 0, Interesting

      Stop the trolling already. Executable size on hello-world demo stuff is a known and addressed non-issue. Write an actually functional program, disable debugging and strip the binary. The result is hardly different from C++ anymore.

    3. Re:Mozilla and Rust by Anonymous Coward · · Score: 0

      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.

      I work with microcontrollers professionally, including ones in the past with less than 8kB of program memory. I am also aware that hello world programs in many languages by default will statically link libraries and be huge. A simple C++ hello world came out to 800kB executable, but drops to several kB when dynamically linked. That is about the same size as a simple Rust program that has been dynamically linked to libraries. Even then, that is large compared to microcontroller programs because executable file formats on desktop OSes can have a lot of headers with extra information, as opposed to just jumping into opcodes. If you really care, you can strip that down too, regardless of language the program was written in.

    4. 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.

    5. 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.
    6. Re:Mozilla and Rust by Anonymous Coward · · Score: 0

      The rust program is only large because rust still statically links the standard library into the binary by default. If you statically link libc/libc++ you will end up with a similarly large binary. Just like with C, you can omit the standard library for embedded/kernel use. Hopefully the rust folks stabilize the ABI for the rest of the v1.x series of releases. It's rather ridiculous that it still varies between compiler version.

    7. 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.
    8. Re:Mozilla and Rust by Anonymous Coward · · Score: 0

      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 ?

      It was Mozilla's COC, of course. :-D

    9. Re:Mozilla and Rust by Anonymous Coward · · Score: 0

      Please do not spread fake news. That is the runtime plus debugging info. You can very well use Rust for embedded programming and it's on par with C. There is a free book about it if you are interested : https://github.com/rust-embedded/book

    10. 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.

    11. Re: Mozilla and Rust by Anonymous Coward · · Score: 0

      He's not trolling at all. While hello world is a terrible example, real functional programs are actually several times larger than the equivalent in C. Even after stripping and going to extraordinary lengths to minimise size, we're still talking twice as large. 300kB vs 800kB, for example. Have you managed to make a functional complex application in rust that you were able to shrink much below 800kB? No? I didn't think so. For some use-cases the compromise is worth it, for others not so.

      Rust is very promising, but that doesn't mean it's suitable for all situations right now. In the future it might well be, but right now it's just another tool, suitable for some jobs and unsuitable for others, just like C or C++.

    12. 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

  31. 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.

  32. C/C++ is not a language by Anonymous Coward · · Score: 0

    Please stop using this stupid fucking contraction.

    1. Re:C/C++ is not a language by Anonymous Coward · · Score: 0

      It's not a language, it's a way of life.

    2. Re:C/C++ is not a language by Anonymous Coward · · Score: 0

      No. Get over your hangup. It's pedantry and contributes nothing.

    3. Re:C/C++ is not a language by GuB-42 · · Score: 0

      C/C++ is not a language

      C/C++ is one.

    4. 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.
    5. Re:C/C++ is not a language by Anonymous Coward · · Score: 0

      No, C / C++ 1 .

    6. 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++.

  33. Serious clickbait by Anonymous Coward · · Score: 0

    Even for apple hater msmash. Silly girl.

  34. Comment removed by account_deleted · · Score: 1

    Comment removed based on user account deletion

  35. This has always been my main complaint about c/c++ by CrankyOldEngineer · · Score: 0

    The performance hit is just the cost of doing business. Even the best programmers make mistakes, and the consequences are too great.

    --
    COE
  36. 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 Anonymous Coward · · Score: 0

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

      If that's true, that's a pity. It is about time that C and C++ are replaced by something sane. And I say that as someone who wrote his first C code in 1982, and who hasn't stopped writing C.

    6. 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.

    7. 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.

    8. 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.

    9. Re:More Rust propagnda by Anonymous Coward · · Score: 0

      and...

      A language that is immature and not yet suitable for lots of tasks that C or C++ are.

      Why oh why have language wars become the modern equivalent of vim vs whatever that other shitty editor is called.

      They're just tools people! Evaluate their pros and cons for each project and use the most appropriate one.

    10. 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.
  37. 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.
    4. Re:All the way down. by Anonymous Coward · · Score: 0

      A good point. CPU cycles cost electricity, which costs money, power, and pollutes the atmosphere with carbon from burning fossil fuels.

      Therefore, using a safer but less efficient language like Rust is contributing to global warming. :)

  38. 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 Anonymous Coward · · Score: 0

      You are just as guilty of a fallacy: Correlation without causation.

      You are assuming that if only we got rid of X then all of the problems would go away. Heads up: They wouldn't. They would just occur elsewhere. Now you may have an argument that if you are using C / C++ in a project you should make sure you actually need it first, and if so give as much time and expertise as necessary to do so properly, but that is not the argument you're making here. Guess what? At the lowest levels something has to implement the frameworks for everyone else. C / C++ lend themselves to that task very nicely. Things like Java / Python / Darling language of novices of the day do not.

      The real problem as it has been stated numerous times is: Inexperienced programmers regardless of the programming language used. C / C++ expects the programmer to know a lot more about how computers work on a general level, memory management / pointer arithmetic / integer overflows / code paths / etc, than other languages do. In exchange however, it allows for more direct control over the hardware itself. In ways that other languages cannot or will not allow, that are needed in systems programming. It's generally not needed in applications programming. Unless you have a high, fractions of percentage points matter, performance requirement for a special use case, and / or legacy compatibility.

      Where we get problems of course is the run fast and hard mentality that computer programmers today have. Along with deadlines that are unreasonable, upper management that doesn't care so long as it's done as cheaply as possible and the cost to cover it up is less than the cost to fix it, and teachers teaching languages instead of concepts to a group of students who have no critical thinking experience. In short it's a human problem not a technical one. Of course it being a human misbehavior issue, rather than actually correcting said misbehavior, in this day and age we choose to kick the can of responsibility to someone else further down the road. Someone who is increasingly often unable to fix it even if they know how to do so. Even the TFA is just kicking the can again. After all why put responsibility on yourself when you can just blame the language and suffer no consequences by saying: "But X made me do it!"

    2. Re:It's not a deadline problem (mostly) by Anonymous Coward · · Score: 0

      Projects where there are no time deadlines? What world are you living in, because I want in.

    3. Re:It's not a deadline problem (mostly) by Anonymous Coward · · Score: 0

      Guess what, they still occur. In fact, some bugs occur a LOT more.
      All those deserialization attacks? Loads of Java (including Android apps) affected, even Ruby.
      Decades old directory traversal attacks? Also Java, because they are stuck with a braindead zip API that basically pushes you to write vulnerable code. And developers will keep using it, because it's the only one built-in.
      Any of these are ridiculously easy to exploit. Buffer overflows are FAR harder to exploit than that, and the easiest to exploit ones a good compiler or static analysis tool will find (and optionally protect against).
      Blaming C is a sign of ignorance about the horrible exploits spread all over the whole Java ecosystem (or Ruby or whichever language you like, except those that don't have a ecosystem I guess).
      Maybe Rust will be better. Or maybe in 5 years they also find a horrible misdesign that lead to vulnerable code all over but they don't want to fix because of backwards compatibility.
      Either way, security needs to be managed. And thanks to decades of experience with buffer overflows etc., I would claim there is A LOT more experience and processes for that in the C world. Chaos and long-lasting damage due a vulnerability are far more likely in ecosystems that is full of "we are magically secure" dreamers.

    4. Re:It's not a deadline problem (mostly) by Anonymous Coward · · Score: 0

      I've made plenty of safe C++ code. These types of mistakes are made from using C or the bits of C included in C++. RAII is perfectly safe.

      Memory unsafety is important for optimization.

      Here's the real problem: Skilled programmers are not desired, productive ones are. Being productive often means ignoring safety considerations.

      Nobody is paying me to fix the shit that's wrong with modern programs. And nobody will. So stop complaining about C / C++ and start complaining about the fact nobody gives a shit about doing things right when they can do it cheap.

      And no, Java and "memory safe" languages are not a solution to the problem. You need to deal with memory at some point, so that just pushes the burden somewhere else and also results in an efficiency loss.

    5. 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.

    6. Re:It's not a deadline problem (mostly) by Anonymous Coward · · Score: 0

      The Internet doesn't have a problem with C/C++, it has a problem with the people that write the code (aka programmers). The high demand for good programmers cannot be satisfied, so often you have to higher less than good or average people. Or in other words: The technology itself isn't broken, it's the economic market and its requirements (hey, wasn't it supposed to be a free market?) that breaks technology.

    7. Re: It's not a deadline problem (mostly) by Anonymous Coward · · Score: 0

      Silicon Valley nominal wages have been stagnant for 15 years, while cost of living tripled. There is NO real demand for programmers.

    8. 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.

    9. 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.

    10. Re:It's not a deadline problem (mostly) by Anonymous Coward · · Score: 0

      On Point 2:
      Those are vulnerabilities in the java implementation, which is (you may have guessed) in C++.

  39. Touch a Nerve or Something? by Anonymous Coward · · Score: 0

    All the C developers below seem awfully sensitive about this.

    Is it such a burden for the next version of C to enforce array boundaries?

    One would almost think that the C community actually prefers it this way.

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

      Yes. If you want that feature, pick from one of the many alternatives. Create C for babies yourself, but leave C alone.

    2. Re: Touch a Nerve or Something? by Anonymous Coward · · Score: 0

      Totally valid. Difficult to compare different views. Here is something I know with 100% certainty: you would never write a novel in C++.

    3. 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.

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

      I think you mean create C for non-idiots?

    5. 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?

    6. Re:Touch a Nerve or Something? by Anonymous Coward · · Score: 0

      I know how to code.

      And yet your pseudo-code contains a rather glaring flaw. Usually I try not to criticize such simple mistakes, but given the arrogance that you are expressing, I will make an exception.

      Regardless of whether your arrays start at 0 or 1, your loop will fail to address one valid element.

      If they start at 0, the first element will be assumed invalid and an exception thrown.

      If they start at 1, it will be the last element, which will simply be ignored.

    7. 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?

    8. Re:Touch a Nerve or Something? by Anonymous Coward · · Score: 0

      Of course. We are talking about BAD programmers here. So, OF COURSE, they haven't even explored what their tool can do.

    9. Re: Touch a Nerve or Something? by Anonymous Coward · · Score: 0

      With an unbounded pointer it is possible to bypass that check by accident. Using only managed pointers in c++ and bounds checked accessor functions makes this kind of bug impossible. But it can easily happen.

      Though I am not sure if buffer overflows are still the most dangerous exploit, it is difficult to exploit with DEP and ASLR, but of course if successful the impact is very bad. I think XSS/SQL injection is bigger today.

    10. 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.

    11. Re: Touch a Nerve or Something? by Anonymous Coward · · Score: 0

      Please return your nerd card and turn off the lights before you leave.

    12. Re:Touch a Nerve or Something? by Anonymous Coward · · Score: 0

      At first I thought they were just being an arrogant asshole, but seeing your post makes me thing this might just be Poe's Law.

    13. Re: Touch a Nerve or Something? by Anonymous Coward · · Score: 0

      Maybe the bad coders have been exploring their other tool instead.

    14. 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.

    15. Re:Touch a Nerve or Something? by Anonymous Coward · · Score: 0

      People who push their favourite alternative language either are or intentionally ignore it.

    16. Re:Touch a Nerve or Something? by Anonymous Coward · · Score: 0

      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?

      You cannot fix stupid. Dumb people will make security issues in any language:
      https://heimdalsecurity.com/blog/java-biggest-security-hole-your-computer/
      https://www.helpnetsecurity.com/2014/04/15/the-security-of-the-most-popular-programming-languages/

    17. Re: Touch a Nerve or Something? by Anonymous Coward · · Score: 0

      Fine then they should stick to sales.

    18. Re: Touch a Nerve or Something? by Anonymous Coward · · Score: 0

      For C arrays you never try to access the length member, because it's out of bounds. Consider, length=4. Array[4] is out of bounds.

    19. 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.

    20. 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.

    21. 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.

    22. 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.

    23. Re:Touch a Nerve or Something? by Anonymous Coward · · Score: 0

      I think you mean create C for non-idiots?

      C for non idiots already exists, it's called C. It's the idiots who complain about C being 'too hard'

      Leave C alone and go create your own MORON_C (You can even replace that underscore with an 'I')

    24. Re: Touch a Nerve or Something? by Anonymous Coward · · Score: 0

      It amazes me people complain about openssl (yes that codebase is crap), but have never spent a cent/hour improving it.

    25. Re: Touch a Nerve or Something? by Anonymous Coward · · Score: 0

      I have said the same thing about PHP!

  40. The problem by Anonymous Coward · · Score: 0

    Is unskilled, reckless and lazy programmers.

    1. 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.
  41. Re:Overblown by Anonymous Coward · · Score: 0

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

    Not sure about Python or Java, but in C++, it'll do what it was programmed to do. Throwing an out-of-range error might be a good idea, or you might want the array to increase in size, and return a default value, or a specific value, or you might return the first element, or the last. It's a problem-domain, not a language-domain issue.

  42. 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?

  43. Use Android by Anonymous Coward · · Score: 0

    The author is right. You should use Android instead because most Android programs use the safe Java language and Android has virtually no security holes or any problems with privacy.

  44. 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 Anonymous Coward · · Score: 0

      > 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.

      First edition UNIX was written in assembly language. Version 4 was the first version written in C.

      The original DOS was written in assembly language.

    2. Re:Python or Java Couldn't Exist w/o C/C++ by Anonymous Coward · · Score: 0

      That's not the point of the article. It's extremely difficult (read expensive) to ensure that all of the possible buffer-overflow, read-past-the-end and other memory access errors are removed from a large program written mostly in C/C++ by many programmers of varying skills working in different programming cultures. It is much less expensive to remove those errors (or prevent them from occurring in the first place) if the project is written in a language (or languages) that help you along the way.

      But of course this is all obvious.

    3. 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.

    4. 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.
    5. Re:Python or Java Couldn't Exist w/o C/C++ by Anonymous Coward · · Score: 0

      OSs written in Java... hum... I don't remember seeing the Java API for low-level interrupt handling.

      Oh, you must mean "OS" as in the Windows UI layer. Yeah, that's nor an OS. OP probably meant OS as in OS, ie kernel. Unless the computer can boot directly of Java bytecode, your "OS" will have an Assembly or C layer to start the JVM. I'm not sure which product you're referring to, but I would not be surprised if it was a C bootloader and a bunch of "native" C Java libraries supporting the upper layers.

    6. 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.

    7. 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.

    8. Re:Python or Java Couldn't Exist w/o C/C++ by Anonymous Coward · · Score: 0

      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?

      You obviously have not written any embedded software.

    9. Re:Python or Java Couldn't Exist w/o C/C++ by Anonymous Coward · · Score: 0

      Hahaha, yeah, fuck me :-) Plenty of OSes written in JAVA? Can you tell us poor ignorants exactly how these OSes written in FUCKING JAVA can work with the internals of the MMU, work with IRQs et al? Do you even know what the fuck I'm talking about? I very much doubt it. You are a fucking moron. The REAL OS code is written in C/C++ and assembler. Maybe it's presenting you with a JAVA API, maybe the GUI is written in Java, but the fucking OS just CAN'T be JAVA. Yeah, you are a real moron.

    10. Re:Python or Java Couldn't Exist w/o C/C++ by Anonymous Coward · · Score: 0

      Early DOS was actually written in Assembly. You can download the source for some very old versions here: https://github.com/Microsoft/MS-DOS. The original predecessor, 86-DOS, was also written in Assembly.

      Newer versions do employ C code, but my understanding is that it remained mostly Assembly.

    11. Re:Python or Java Couldn't Exist w/o C/C++ by Anonymous Coward · · Score: 0

      C and C++ do not hide the underlying machine

      Question: How do you check for an integer overflow in C or C++?

      Just check the relevant processor flag, right?

    12. 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.

    13. 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.
    14. Re:Python or Java Couldn't Exist w/o C/C++ by Anonymous Coward · · Score: 0

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

      Try again - the JavaOS microkernel is written in C.

    15. 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 ;)

    16. 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.
    17. Re:Python or Java Couldn't Exist w/o C/C++ by Anonymous Coward · · Score: 0

      Not obvious at all, since Java doesn't offer things like bare pointers and bitwise operations.

      If it's so obvious, why didn't they do it?

    18. 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.

    19. 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.
    20. Re:Python or Java Couldn't Exist w/o C/C++ by Anonymous Coward · · Score: 0

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

      This is simply false. If you've studied language design you'd know that some languages are tailored to system programming and others simply lack the constructs needed.

      A compiler that generates "arbitrary" native code is called an assembler. Otherwise it just translates the language into machine code based on the language's grammar, and if you want fine-grained control you have to design it into the language.

    21. 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.

    22. 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.
    23. Re:Python or Java Couldn't Exist w/o C/C++ by Anonymous Coward · · Score: 0

      Compiling to native code and being able to access arbitrary memory, is all what you need to write a pure OS ... in any language.

      Ok, let's see your Java interrupt handler.

      For that matter, please show us how to access arbitrary memory locations in Java.

      I'm talking standard Java here; no proprietary compiler tricks.

    24. 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?

    25. 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.
    26. Re:Python or Java Couldn't Exist w/o C/C++ by Anonymous Coward · · Score: 0

      Take a look in the 'jcore' directory of the source code...

    27. 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.

    28. 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. Re:Python or Java Couldn't Exist w/o C/C++ by Anonymous Coward · · Score: 0

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

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

      Look at the source code - the microkernel portion is in C.

      I thought your claim is that it's possible to write an OS entirely in Java? You haven't been able to point to a single example yet.

  45. Alex is a software security engineer at Mozilla by Anonymous Coward · · Score: 0

    If this jackass is really a security engineer at Mozilla, I'm going back to Chrome.

  46. 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?

  47. Re:Overblown by Anonymous Coward · · Score: 0

    COBOL, FORTRAN VB, Java, Pascal even, they all return an index error, "out of range" or something similar.

    WTF with C?

    How do they do that? How does the program know that you requested an index that was out of range? The answer is that the programs add extra code into the executable that checks every memory request and verifies that it is a request for in-range memory before it allows the program to read it. (There's actually significantly more to it than that, since there's a lot of additional code required for memory management above and beyond just checking indexes.) That's great from a security perspective but it absolutely sucks from a performance perspective. It depends a great deal on the specifics but the difference in performance can be several orders of magnitude in some circumstances. If you hand most people two devices and one is snappy and responsive while the other is slow and laggy, most people aren't going to care that the slow one is much more secure.

  48. As others have mentioned by Anonymous Coward · · Score: 0

    Article is click baity and lacks technical insight. Heartbleed doesn't affect Linux it affects OpenSSL. Stop blaming the OS for bugs in third party libraries. This article focuses on the fact that c/c++ makes the developers manage memory themselves. Can you please tell me how and what language I can use to design an OS without managing hardware things like memory. Its an Operating System, if you can't manage lower level hardware operation in your code you probably shouldn't be coding something that its sole purpose is managing lower level hardware operation.

  49. 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.

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

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

  51. 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++.

  52. 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.

    1. Re:K&R by Anonymous Coward · · Score: 0

      You jest, but watch this video: The Birth and Death of Javascript. I dare you to decide whether that's farcical or visionary, especially considering recent discoveries of flaws in CPUs.

    2. Re:K&R by Anonymous Coward · · Score: 0

      More so than Bill Gates' original Basic compiler written in the Original Klingon.

  53. Re:Overblown by Anonymous Coward · · Score: 0

    You should never count on developers being great. Most people will never be great, only adequate. If they're good, they'll be given ever more complex and difficult tasks until they're merely adequate.
    It should be tools and processes that are great, because they can be replicated more easily than great developers. We should just admit that some developers will inevitably make mistakes, because they're only human.

  54. Re: It's not the language, you stupid jackwagons.. by Nutria · · Score: 0

    Don't be jackass, jackass.

    --
    "I don't know, therefore Aliens" Wafflebox1
  55. 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.

  56. Re: It's not the language, you stupid jackwagons.. by Anonymous Coward · · Score: 0

    None of those things are meaningful when the 18 wheeler smashes your little car flat. Picture?

  57. 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.
  58. Switch to Erlang. by Anonymous Coward · · Score: 0

    Problem solved.

  59. 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 Anonymous Coward · · Score: 0

      Yeah it sucks having to learn new things, doesn't it?

      Yup. Unfortunately, that's life: the rules keep changing and the goalposts keep moving.

    2. Re:Enter Modern C++ by Anonymous Coward · · Score: 0

      Apart from writing that sort of code, what is the likelihood that any person likely to be assigned to maintain the code is going to be able to deal with that type of thing?

    3. 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++.

    4. 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.
    5. 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."

    6. Re:Enter Modern C++ by Anonymous Coward · · Score: 0

      It's not about learning new things. It's just like he wrote, that code is definitely written for a compiler and not for a human.

    7. Re:Enter Modern C++ by Anonymous Coward · · Score: 0

      Yeah, it kinda does, when there was nothing wrong with the old version.
      I'm an assembly programmer at heart but mainly program in C++ and Java these days.
      I'm so tired of the new language features they keep adding. I don't need them. I don't want them. It's just more shit to learn.

    8. Re:Enter Modern C++ by Anonymous Coward · · Score: 0

      Unless you've found a way to cheat death, readability and maintainability still matter.

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

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

    10. 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.

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

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

    12. Re:Enter Modern C++ by Anonymous Coward · · Score: 0

      hey i am a java dude here and I was finding it quite readable, the only surprising thing is the lack of parenthesis in the construction of the originals and triples vector.

    13. Re:Enter Modern C++ by Anonymous Coward · · Score: 0

      How does that code convey the intent to the user?

      How about the fact you used "std::transform"? I know it's doing a map because the function name told me. You didn't need to tell me it was a map.

    14. Re:Enter Modern C++ by Anonymous Coward · · Score: 0

      Yeah, the evolution that C++ had to follow led to the current structure being far from intuitive. It has constructs that work fine, but which had to be hacked into existing syntax and backwards compatibility, and which would never have been designed the way they were if they were being created from scratch.

      I'd love to have a language nearly identical in power and scope as C++, but just clean and elegant, eliminating the cruft accumulated over the decades.

    15. Re:Enter Modern C++ by Anonymous Coward · · Score: 0

      But that code was written for a compiler, not a human to understand.

      WTF do you think source code is written for?

    16. Re:Enter Modern C++ by Anonymous Coward · · Score: 0

      >> But that code was written for a compiler, not a human to understand.
      > WTF do you think source code is written for?

      High-level languages are machine-translatable codes designed for humans to understand.

    17. Re:Enter Modern C++ by Anonymous Coward · · Score: 0

      While not my style, how does that not convey intent?

      I want to perform a transform taking from a range from a filled in vector and inserting the transform into my new vector. I want this transform to multiply everything by 3. Moving to an iterator style makes much of the criticisms of C++ invalid.

    18. Re:Enter Modern C++ by Anonymous Coward · · Score: 0

      This is the style I write in and it looks perfectly readable to me (minus the missing angle brackets that slashdot removed)

  60. Re:Overblown by Anonymous Coward · · Score: 0

    That's why you should give those ones crayons instead of pencils, for when they poke themselves in the eye.

  61. 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.

    1. Re:And the solution? by Anonymous Coward · · Score: 0

      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.

      #leavenosoftwaredeveloperbehind

    2. Re:And the solution? by Anonymous Coward · · Score: 0

      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.

      easily the best comment in the thread

    3. Re:And the solution? by Anonymous Coward · · Score: 0

      https://www.destroyallsoftware.com/talks/the-birth-and-death-of-javascript

  62. 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).

  63. 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.
  64. Re:C? you newbies by ponraul · · Score: 1

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

  65. C and C++ is low level by Anonymous Coward · · Score: 0

    Low level languages are just the thing for low level code like things that interact with the OS or performance critical libraries or services.

    But, you have to be more careful when you write such code.

    I would say that the effective size of a C program/library that can be confidently considered safe is much smaller (i.e, it does less) than a program written in a high level language like Java. That's just the way it is. Right tool for the job, as always.

    C at least is not a general purpose programming language at this point. Probably the same is true of C++. But nothing can beat them for small size and quick speed!

  66. 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.

  67. 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
  68. Not a buffer overflow by Anonymous Coward · · Score: 0

    At least get that right.

  69. 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.
  70. 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.
  71. 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.

  72. We should only use secure languages. Like PHP. by Anonymous Coward · · Score: 0

    (no text)

  73. 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.
  74. 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?

    2. Re:Computing power is speed. Or security. by Anonymous Coward · · Score: 0

      Bullshit! That's just not true, and everyone who's ever used a Java program knows it. Give me one, just one, single example of a performant, responsive Java application. You can't, they all run like trash!

  75. Inherent choice, not specific C/C++ by Anonymous Coward · · Score: 0

    C/C++ are kind of like assembly language and allow one to program close to the hardware for efficiency. One can optionally access data structures through wrappers/API's that check and protect boundaries, but such checks require processing resources. Thus, it's not directly the "fault" of C/C++, but of library usage decisions.

    If you don't want "leaky" structures, you pretty much have two choices: use libraries or languages that check every access request (which slows things), or write carefully.

    It's only a language issue in that you CAN skip such checks in C/C++ if you so choose. That they give you an option to skip should not necessarily be held against them. I suppose you could argue that no software should be written without built-in inspection, but we'd have slower stuff and/or have to buy more hardware.

  76. 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.
  77. 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.

  78. Java is the solution by Anonymous Coward · · Score: 0

    Java is the obvious solution for everything.

    Security, Performance, Stability, and "Write Once, Run Anywhere", java has it all.

    All you need for a simple application is a few GB of ram, a few cores [ at least 4 ] , and a 20-30Gb of disk space for a few helper libraries, and you are all set. Then, all you need is the right JVM, and the right libraries, and of course, just a few more GB for compatibility libraries "just in case".

    "Hello world" compiles and runs in just minutes on a i7 with as little as 4GB of ram!

    Think about it, for a small cost of memory and disk space, and a few cpu cycles, you can have the fastest, more secure code ever!

    Or, you know, you could just hand over all your data, whatever works for you.

    1. 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.

    2. Re:Java is the solution by Anonymous Coward · · Score: 0

      and disk space, and cpu cycles.

      Write Once, run on the "correct" jvm, with the "right" set of libraries, when the moon is in the correct phase, and if you don't look at it too closely.

  79. ha by Anonymous Coward · · Score: 0

    Most of those "memory safe" tools were written in C/C++ too, you know. I think OP should give good example and quit using the Internet in protest.

    1. Re: ha by Anonymous Coward · · Score: 0

      Hahaha, exactly!

  80. 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.

  81. 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
  82. 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

  83. 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
  84. Human Bones Break; flexible plastic is the future. by spikeysnack · · Score: 0

    Is about the level of understanding here.
    The Internet and indeed every single piece of computing hardware above a
    calculator is done in C. So are all the other languages such as Java, Python, etc.
    This is ridiculous and I know the publishers of /. are NOT THAT DUMB.

    Or at least they used to be.

    Buffer overflows and Null pointer exploits are avoidable, but
    eliminating the benefits of direct memory access will cripple
    everything going on right now in hardware, as well as the entire
    infrastructure of the internet as it has evolved.

  85. Infrastructure isn't built by Anonymous Coward · · Score: 0

    It's rebuilt.

    Where would our vaunted tech culture be without C?

  86. 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 Anonymous Coward · · Score: 0

      You have no idea what you're talking about; if all programs on your machine would be built in hip fly safe languages it would grind to a halt. Tried atom lately?

    2. 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.
    3. 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?

    4. 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

    5. Re:Wrong tool for the job by Anonymous Coward · · Score: 0

      Definitely assembler. People think C is really close and yet I've many times been able to speed up critical code by more than an order of magnitude by going from C to assembler. Programming in C takes the mind away from thinking about the machine as a machine that often has unique strengths and abilities that C shirks in order to be portable.

    6. 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!
  87. and in other news... by Anonymous Coward · · Score: 0

    a steak knife could be used in a restaurant to harm some one... restaurants are insecure and should switch to using scissors for all meat cutting activities...

    ...oh wait...

    ...scissors could be used..........

    1. Re:and in other news... by Anonymous Coward · · Score: 0

      a steak knife could be used in a restaurant to harm some one... restaurants are insecure and should switch to using scissors for all meat cutting activities...

      Someone has never been to a Korean restaurant.

    2. Re:and in other news... by Anonymous Coward · · Score: 0

      touché


      I still think C is pretty awesome, though. How's that for a counter argument? :p

  88. Allowing this type of error is NECESSARY. by superwiz · · Score: 0

    Like, don't like it, it doesn't matter. Languages which create workarounds around this simply can't express everything computers do.

    Computers can write past a boundary which they must obey. You can put in extra checks. The operating system can put in extra checks, but it doesn't matter.

    There will be times when it will be necessary to do this when doing system programming. And any language which does not allow it cannot become a systems language. In fact, allowing this type of thing is necessary for Turing completeness.

    Any language which doesn't allow it, will necessarily limit the scope of problems it can solve and it will need to be extended with external facilities which solve these problems and pretend that they are already solved "naturally". But these solutions will be created by hooking in libraries written in some Turing complete languages. Heck, even basic was "safe" until you wanted to do something to actual hardware. And at that point you had to peek() and poke(). Or you had to use libraries which did. And peek() and poke() is touching memory to which you don't have abstract access in the language naturally.

    --
    Any guest worker system is indistinguishable from indentured servitude.
  89. Re: Overblown by Anonymous Coward · · Score: 0

    First, C++ has nothing to do with C in term of security. And if you speak about "C/C++", you just show you do not know what you are talking about.

  90. Yeah by Anonymous Coward · · Score: 0

    This "C/C++ is automatically bad" attitude is universally held by people who aren't quite smart enough to really grasp C/C++.

    It isn't good or bad. But it is low-level, so you have to be good to use it. Not "just anybody" can use it competently.

  91. 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!
  92. 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.

  93. 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.

  94. Re:Not overblown, not a bullet item but important by Anonymous Coward · · Score: 0

    The original poster didn't make it a bullet item, but mentioned it later, 'written in a hurry'. One very common experience I had was that I'd have to get it done in two weeks.

  95. Moronic by Anonymous Coward · · Score: 0

    This doesn't even pass the bar for a populist article. WannaCry is ransomware, not a bug. Many of the worst vulns in the last couple of years have been deserialization attacks in HLLs like Java and Ruby. That description of a buffer overflow has literally nothing to do with how buffer overflows work (they involve writing data, and critically gaining control of execution).

    While certainly rust and other memory safe languages can fix some sorts of attacks against C and C++, and indeed stack and heap protection in conjunction with ASLR already do, the idea that C and C++ equate to the cybersecurity risks we face is pure nonsense. Memory safety is a useful tool, but it's like saying a hammer is a solution to a housing shortage.

  96. Re:What he said was true by Anonymous Coward · · Score: 0

    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.

    I am not familiar with Rust, but there are several other languages that it is easy to write a program that will catch every possible error (outside of severe hardware faults) and at least attempt to do some clean up and report vaguely what happened. That is a lot different than memory errors that get your program terminated instantly by the OS (or can bring the OS down on some simpler systems).

  97. 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.
  98. Python,Java = Joke by Anonymous Coward · · Score: 0

    Clearly a millennial wrote this article. Javacrap is the first programming language they learn and they think they know everything there is to know about programming.

    1. Re:Python,Java = Joke by oh_my_080980980 · · Score: 1

      That or a RUST salesman.

  99. 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.

  100. 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.

  101. BS from someone who should know better by WaffleMonster · · Score: 0

    Alex is a security dude at Mozilla. Yes the very same company whose browser is so insecure it's not even on the menu of hacking competitions because exploits are too easy to come by.

    A security dude who believes "If we make that change and that investment we can make a dramatic improvement to computer security for all users, and make HeartBleed, WannaCry, and million dollar iPhone bugs far less common."

    I was very much looking forward to seeing Mozilla lead by example and port the whole browser to Rust or whatever without cheating by ever using any of the unsafe methods the Rust language provides yet it seems this isn't even on the roadmap. Apparently continuing to add new features and improving "performance" is more important to Mozilla than security of their users. They can improve security of their browser right now by compiling it with compile time guards and using any number of third party tools that protect against these things with existing codebase yet Mozilla is consciously choosing not to even though it's security record is among the worst of major browsers.

    It is scary yet unsurprising a security guy would believe false nonsense eliminating software bugs would bring about a "dramatic improvement to computer security". The fact is well over 90% of breaches exploit people not weaknesses in computer code. If you snapped your fingers and magically removed all vulnerabilities from all software and hardware tomorrow globally nothing would change. For someone in his position not to understand this basic reality is extremely disconcerting. It means he's trying to saw off the visible portion of an iceberg above water to keep from damaging ships in its path.

    A bigger issue is that when developers sit down to choose a programming language for a new project, they're generally making their decision based on what languages their team knows, performance, and ecosystem of libraries that can be leveraged. Security is almost never a core consideration. This means languages which emphasize security, at the cost of ease of use, are at a disadvantage.

    Major languages supposed to be immune to low level memory issues are way easier to use.

  102. 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?
  103. Trust but verify once please by Anonymous Coward · · Score: 0

    C and C++ permit you to construct schemes to carry variable sized things with bounds checking.
    Perhaps this doesn't happen because it's extra work. Both for the programmer and for the cpu.
    Switching to RUST might help the programmer, but not the cpu.
    A system that does bounds checking is likely going the check the bounds on something every time it uses it.
    (Plan1: Trust but verify, verify, verify,...)

    In theory, with C++ one could check the size of inputs once and then assume they are ok through the program.
    (Plan2: Trust, but verify once)

    In practice programmers and human which leaves no checking.
    (Plan3: Trust, but don't verify which makes the bad guys happy.)

    If you believe that optimization is something only to be done where it's needed, then the first plan wins, except in special cases where the second plan wins.
    Interesting that Plan 3 is not ever desired, but often is used.

  104. I'm really looking forward to the new pyPhone by Anonymous Coward · · Score: 0

    Programmed completely in python, and comes with non-optional emacs-based menu system.

  105. 25 year C and Cpp veteran ... by Anonymous Coward · · Score: 0

    .. and this article is absolutely accurate. C and C++ should only be used for low level systems programming and device drivers. The only feature I want from C++ in my higher level languages, Csharp, Swift, Rust, Julia, is complete Cpp18 constant expression support. Give me that and I will never touch C or Cpp again, except for the occasional device driver.

  106. 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."
  107. 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)

  108. 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.

  109. 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'
  110. 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.

  111. 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..

  112. Re: Overblown by Anonymous Coward · · Score: 0

    1ms of overhead is too much when your application is a game or a simulation. Sure the web browser may not matter, because there are often 4 levels of abstraction by that time.

  113. Re: It's not the language, you stupid jackwagons.. by Anonymous Coward · · Score: 0

    In the real world you work with what you're told to work with, or with what provides a large pool of existing libraries

  114. 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
  115. Coding 101. by Anonymous Coward · · Score: 0

    Handling this in code is part of any C/C++ beginners tutorial.

    Don't blame the tool - blame the dumbass who hired another dumbass to do an important task.

  116. 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.

  117. There's no I in denial by Anonymous Coward · · Score: 0

    The C language literally allows these things to occur.
    Its syntax makes it much easier to write the unsafe code and bad pointer arithmetic, than write the safe code.
    How could it not be to blame?

  118. 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
  119. 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

  120. Re:Lousy or inexperienced programmers are the prob by Anonymous Coward · · Score: 0

    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.

    Good god I hope your just trolling.

  121. Prog. who give up liberty for security get neither by Anonymous Coward · · Score: 0

    Most languages ultimately depend on C/C++. Punting problems does not solve it. In the end, energy to run programs on millions of devices will be the critical deciding factor. And without the bugs, we would not have a whole new job marked called "Cybersecurity"

  122. 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 Anonymous Coward · · Score: 0

      >

      Correct me if I am wrong. If you allocate a new segment register for every malloc call, you run out of segment registers pretty quickly on the Pentium processor, don't you? If that is the case, you can't just willy nilly assign a new segment register every time a malloc call comes your way. Having an unlimited number of segment registers would easily solve the problem, but the segment ID of the segment register is only so many bits in length, which indicates how many segment registers you can have on the processor for each task. Intel would have to create a segment ID that would be enough bits in length, so that you would never run out of segment registers in practice, even on a super computer. But in reality, there is only so much physical memory available to hold segment registers.

    5. 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.
    6. Re:Can we please stop this nonsense? by theweatherelectric · · Score: 1

      What a despicable propaganda piece.

      Oh, you're serious. Poor dear.

    7. 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.
    8. 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.

  123. I was updating SSL when I saw about heartbleed by Anonymous Coward · · Score: 0

    I was updating SSL when the noted that the *NEW VERSION* fixes an overflow bug. So the announcement that heartbleed exists, was the new version of the software (SSL) that fixed the bug. The storm that followed came from the news and sites that waited as long as possible to update their systems, while malicious miscreants did their evil. Years ago there was a networking site/webzine called Security Portal that had a weekly column titled "Ask Buffy, by Buffy Overflow". It was all about buffer overflows. This was about 18 years ago. Now that some boffin at Vice has noticed" "hey, I just discovered something called a buffer overflow! I think I might write an article! People should know!" And the great unwashed are more dangerous, because they have a tiny bit of information. And those who already know will have to tell them "yes, ancient news, thanks again. Linux was never really affected as all I/O gets channeled to a special memory area which doesn't allow program execution. C++ has implemented shared pointers in C++0x (the 2010 version) to allow multi-processing/multi-threading and automatic garbage collection (the shared pointers have a reference index for each application accessing the pointer, and when the reference reaches 0, automatically deletes the pointer and all memory associated with it). So its not quite as dire as the Vice article says, but sensational stories sell clicks.

  124. This is not a C/C++ issue. by Anonymous Coward · · Score: 0

    This is not a C/C++ issue. This can happen in any language.

    Why? Because the vulnerability isn't at the language level, it's at the instruction level. That's the nature of these exploits. Blaming this on a higher level language demonstrates a lack of understanding of how things work at a low level. Which is not surprising, these days people grow up never having written assembly language.

    I was was aware this was a problem back in the early 1990s when graduates at the time had little to no low level knowledge of how the machine they were using worked. Not really a surprise this is still a problem.

  125. So, Vice is bad at tech journalism too by Anonymous Coward · · Score: 0

    My father taught me that bad carpenters blame their tools. He was not a carpenter by trade but rather a master carpenter as a hobby and his work put most professionals to shame.

    Same thing here.

    Anybody can code in any language, just as anybody can cut a piece of wood, but if the results are bad the problem is not the tools.

    Morons write code with memory leaks and buffer overruns. Giving them tools that provide safety rails to protect them and everybody else from their reckless incompetence is a bad idea, since it only masks their underlying incompetence WHICH WILL SURFACE SOMEPLACE ELSE.

    C is a very good language in that it allows a good coder to do nearly anything. Only assembly language gives more power to the coder (you C fanatics need to give in on this and admit that's why C has to allow inline assy code). I'm no C++ sycophant (the operator overloading and templates were bad ideas that good coders did not need but bad coders have abused like a bunch of chimps with machine guns) but overall the language is excellent and it is ceertainly not responsible for bad programmers any more than cars are responsible for drunk drivers.

    People should really be more discriminating in their choices of "news" outlets. Vice is in the same bag with HuffPo - it's a joke if you are a serious, thoughtful person.

    1. 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.

  126. 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.
  127. Re: Overblown by Anonymous Coward · · Score: 0

    Call me when the first browser gets written in C#

  128. 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.

  129. Not a problem with C or C++ by Anonymous Coward · · Score: 0

    This buffer overflow vulnerability has been known about for years, and the Linux Foundation has ignored it. A discussion was available on StackOverflow for the whole world to see and comment on. The vulnerability occurs as the result of a malloc call for a small amount of memory, but Linux sets a boundary for that memory far outside the requested amount. It was discovered, when the tester was trying to generate a segmentation error, but Linux refused to generate the run time error.

  130. 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.

  131. Blame language rather than bad programmers. by Anonymous Coward · · Score: 0

    Let's not blame the idiot programmers who don't know what they're doing, but instead let's force everyone to use kiddy languages for amateurs that ensure they can't fuck anything up. God forbid that amateurs be criticized for not know what the hell they're doing.

    Also, let's remember that Java and Python are COMPLETELY 100% SAFE and that there has never been a single exploit found in these languages...

  132. 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 ?

    1. Re:C/C++ isnt the problem.... by Anonymous Coward · · Score: 0

      > Who thought it was a good idea to let javascript get to the cpu ?

      Um, in all seriousness, where else is it supposed to run?

  133. Re: It's not the language, you stupid jackwagons.. by Anonymous Coward · · Score: 0

    Yes you idiot. Engineers building critical infrastructure in every other discipline require a license. Computer and software systems have become critical infrastructure, and should be held up to the same standards.

  134. 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
    1. Re:C is Assembler 2.0 ... by Anonymous Coward · · Score: 0

      There are two kinds of fools.
      One says this is old, and therefore good.
      The other says this is new, and therefore better.

  135. 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 Anonymous Coward · · Score: 0

      11.6 days isn't really that much if you're a bank with many cash to burn. You can just upgrade to 50-core CPU to calculate that table properly.

    2. 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.

  136. 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
  137. 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.

  138. Your job is not universal by Anonymous Coward · · Score: 0

    Back in the day, I doubled the performance of a piece of code by changing "divide by two" operations into bit-shifts (arithmatic shift right, because the A/D hardware guaranteed the values were always positive) in the innermost data gathering loop.

    Afterwards, instead of the program crashing hard two thirds of the way into a test that cost hundreds of thousands of dollars each time it was run, the program ran to completion safely, basically because it could keep up with physical reality.

    To put this another way, if saving nano-seconds isn't important, maybe you aren't doing anything exceptionally interesting? There will always be tasks where speed matters, and tasks where it doesn't. I prefer the former!

  139. Re: Overblown by Anonymous Coward · · Score: 0

    You are short-sighted.

    One example from many across the last couple of years. A C++ service that starts up in milliseconds, processes data (for a huge global company - you probably use them) and consumes under a megabyte of memory, before either shutting down or processing more. It replaced something running on a jvm, which by your metrics was roughly the same - under a millisecond per transaction on average. But orders of magnitude higher memory and startup costs - ignoring those today means that your cloud processing costs are much higher.

    Itâ(TM)s all just engineering, not language wars. Get closer to ASM when itâ(TM)s warranted, and donâ(TM)t criticise what you donâ(TM)t understand.

    I only troubled to reply to your misguided post in case anyone else was left with the impression that you have - CPU execution time is not 100% of the execution cost, and those costs are more exposed than ever - AWS charge by the millisecond for a reason.

  140. Re:Overblown by Anonymous Coward · · Score: 0

    you might see a 5 to 10 ms difference on the operation

    When processing high-speed video, doing real-time control, high-speed data acquisition or high-speed trading (to name few examples), 10 ms is an eternity. Operations like this are done all the time and are in everything. This is why C is here to stay for the foreseeable future.

    You can take your hipster new web scripting language and take a hike. Meanwhile, C runs the world.

  141. Re: Overblown by Anonymous Coward · · Score: 0

    Your attitude is why today's software is bloated and slow..and it still has security issues.

  142. I like C. Fuck your newfangled shit by Anonymous Coward · · Score: 0

    I like C. Fuck your newfangled shit

  143. Re: Lousy or inexperienced programmers are the pro by Anonymous Coward · · Score: 0

    This is a good point. What I always do is, right after a strncpy, I will set the final byte as a NUL character just to be sure.

  144. Re: It's not the language, you stupid jackwagons.. by Anonymous Coward · · Score: 0

    Well that will save us from C for sure.

    (Hint; if you believe that, you're a moron)

  145. Re:What he said was true by Anonymous Coward · · Score: 0

    Sshhhh... Quiet, you are going to ruin their fantasies :-)

  146. But Java has WAY too many exceptions by Anonymous Coward · · Score: 0

    "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."

    As a direct result of Java putting exceptions everywhere even for non-exceptional things, here's what I wind up doing:

    while (1)
    {
        try { ... Entire program here ...

            break;
        } catch (Exception e) {
        }
    }

    Yup. That's real. And I don't care. Or at least I don't care when I write Java code.

    Also, Python is inferior to PHP. Fight me.

    For C/C++ code, I'll let it crash hard because I've at least got tons of debugging tools at my disposal, including sweet toys like American Fuzzy Lop.

  147. Alex needs a refresher course I think by Anonymous Coward · · Score: 0

    Heartbleed was NOT caused by a buffer overflow...
        A buffer overflow is when you write more data to a buffer than it has space allocated to it. Like trying to fill a 2 gallon gas can with 5 gallons of gas -- it overflows and gets all over the place. Overflow is a memory writing problem and can allow an attacker to inject code into memory.

    Heartbleed was NOT caused by a buffer boundary problem...
        The mirror image of a buffer overflow is when a program reads data beyond the boundaries of a buffer. This is a memory reading problem and gives the attacker access to memory they would not usually be able to access.

    Heartbleed was NOT caused (technically) by any bug at all...
        It was a combination of at least two problems -- one implementation related and one language related:

      1. I'm sure the RFC specified that the buffer size should match the input size; it appears the implementation didn't check for that match.
      2. The language spec doesn't guarantee the contents of newly allocated memory; in this case, you got what was already in that memory.

    So, the attacker had to make a request with mismatched sizes (which to program didn't validate) and the language implementation didn't initialize (or clear) the allocated memory so that it contained old data (hence the exploit).

    So, the closest thing we have to a bug is not validating input (definitely a security no-no); however, the buffer was allocated correctly (by the language spec) and neither a buffer overflow (didn't write past the buffer size) nor a boundary problem (didn't read past the buffer size) occurred.

    So, Heartbleed was caused by a couple of security no-no's: not validating input and not initializing memory. The first opens the door to exploits and the second is the exploit itself -- mitigate either of those and Heartbleed doesn't happen.

    While it has been some time, I also seem to remember that the actual bug was that the bounds checking code was bypassed because of a misplaced semicolon in a large chunk of condition code. It looked like the bounds were being checked but the checking code was never executed because of the semicolon.

    I have to ask how Alex (a security engineer) doesn't seem to understand what actually caused the Heatbleed fiasco; describing it as a buffer overflow is certainly incorrect as there was no memory management problems in the process (reading or writing past boundaries).

  148. 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...

  149. Re: Overblown by Anonymous Coward · · Score: 0

    I recently rewrote a java program in C. It was accessing and parsing proprietary formatted binary files on disk and spitting out human readable data and performing some basic search functions. The java program took around 2 minutes to parse a file that took the C program around 2 seconds. The performance difference is non-negligible as was the amount of system resources required to run the program in each language. The simple fact is most of the languages, even Python, do not even come close to the performance and efficiency of C.

  150. what? by Anonymous Coward · · Score: 0

    Without C, you wouldn't have any *nix variant. The problem isn't with C or C derivatives. The problem is that bugs are bound to occur no matter what. This is just a puff piece for Rust.

  151. ANSI by Anonymous Coward · · Score: 0

    Let us make all languages ANSI....and stop this crap..!

    1. Re:ANSI by Anonymous Coward · · Score: 0

      Let us make all languages ANSI....and stop this crap..!

      oops rockstars need dollars..!!

  152. I would love to see a computer by Anonymous Coward · · Score: 0

    I would love to see a computer run only on a high level language with no "low" level language to build on top of. Write your whole OS in Python.

    1. 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.

  153. 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.

  154. Re:What he said was true by 110010001000 · · Score: 0

    You need to give it up. No one is going to use Swift. Ever. Language zealots are funny. There is a reason certain languages are popular, and things like Rust and Swift are not.

  155. 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
  156. 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.

  157. Re:C? you newbies by Anonymous Coward · · Score: 0

    "the overflow would feed me cool stuff like chunks of grade reports."

    No it didn't. All it could give you is what the fortran program had.

  158. 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)

  159. C# is king by Anonymous Coward · · Score: 0

    Bjarne Stroustrup wears skinny jeans.

  160. It's the future cobol by Anonymous Coward · · Score: 0

    C/C++ are the future COBOL with a declining pool of possible experienced developers willing to work on a C/C++ project.

    C/C++ project means gaining no skills during the project and effectively losing skills as your non-c/C++ skills get older and older.

    I am back in the C/C++ programming for hourly rates game once it gets to $150+ an hour.

    FWIW, some of the mainframe tools companies products have a code base going back to the early 1970s in assembler and still having forward development.

    My last hybrid .net/c/c++ project ~2015 with 500k+ lines had the 200k+ lines of c/c++ code slowly rewritten to c# over the course of 3 major releases in 2 years. The team could not hire any decent c/c++ developers for rates c# developers got and was unwilling to pay a premium to get quality c/c++ developers.

  161. Bad programming does not bad languages make by Anonymous Coward · · Score: 0

    Just because someone doesn't see the need for untracked memory usage, doesn't mean there isn't a need. The programmer should be responsible for tracking the memory usage. Sloppiness does not make a bad programming language. It makes bad programmers.

  162. Those who don't learn from history... by Anonymous Coward · · Score: 0

    I'm starting to become convinced that everyone writing op-eds about how "C is outdated and Rust is the systems language of the future" are the exact same people who wrote that "C is outdated and Ada is the systems language of the future" 30-so years ago.

  163. Re:Overblown by Anonymous Coward · · Score: 0

    Theoretically those new languages aren't enormously slower than C, as proven in benchmarks. In practice, however, they are much, much slower and less responsive. All those little millisecond differences add up at the scale of a real application. Then you tack on garbage collection and before you know it there is noticeable latency in the application.

    And that doesn't even consider memory consumption, load time, and the general malaise that comes from enormous binaries.

    One or two programs written in fancy languages like Java or C# are ok, but when half the applications you're using day to day are such, it really starts eating into actual time. You know this, I know this, everyone knows this. Modern systems are probably less responsive for everyday work than they were 10 years ago because of all this bloat.

  164. Re: It's not the language, you stupid jackwagons.. by Anonymous Coward · · Score: 0

    That's what ADA was invented for. Do you see ADA used for everything? I certainly don't.

  165. Let's all switch to Object Pascal! by Anonymous Coward · · Score: 0

    My best friend tells me Delphi is the best!

    ZIP

  166. Re: Overblown by Anonymous Coward · · Score: 0

    Bingo! Even working on big data sets I went from python to c++ and 24 hr runtime went to 20 minutes. Rewrote lockfree c++ and it was 13 minutes. Switched from gcc to icc compiler with no other changes and it ran in 11 minutes.

    Huge win and c++ is why...

  167. Re: Overblown by Anonymous Coward · · Score: 0

    "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"

    What you mention is only a basic part of compliation and during run time the kernel is validating memory pages just like it has to for any other language running except that language is doing the same work in user space as well.

  168. Personal responsibility doesn't scale, mate by Anonymous Coward · · Score: 0

    The sort of unreasonable competence your referring to can't be expected at scale. It also supposes that people are infallible.

    These sorts of languages are simply dangerous in a security context and must change or be disallowed entirely from use. Memory unsafety is lunacy.

  169. Real men... by Anonymous Coward · · Score: 0

    ...program in PL-I, or LISP if in a hurry.

  170. Re: Overblown by astrofurter · · Score: 1

    "predict exactly what they will do"

    Lower wages and import more H1-Bs. That will fix it!

  171. seriously by Anonymous Coward · · Score: 0

    Do you really think we dint know this?
    The problem you described is called "Off by one." and is well known. It's a expected part of unmanaged languages.
    As it is not unique to C or C++, or any other language for that matter. And it can occur in java, python, an C#. It is rarer as the garbage collection can hide the problem. But in all cases we ate expected to recognize this and fix it. We know it can lead to bugs and vonuerabilities such as buffer overruns.
    This whole article sounds like someone who is just getting started with the basics, rediscovered this, then didn't bother to look it up, and blamed the language for, it rather than him/her self.

  172. 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.

  173. my first "big" programming problem by Anonymous Coward · · Score: 0

    I had a table containing various numbers, but when loading it it kept spewing nonsense. Due to my errot, I was always loading different part of memory than I intended. I concluded that is the case after cca 30 mins, fixed the code and added around four lines of another code that should catch the problem should it arise again.

  174. 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."
  175. Overblown, C++ isn't that hard yo by Anonymous Coward · · Score: 0

    One, not a buffer overflow. Two, if you're really concerned about this you can turn on bounds checking (side note, it's dog slow). Three, modern C++ has language features that eliminate many historical problems

  176. 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.

  177. No Problem by Anonymous Coward · · Score: 0

    Hey hipsters: How's that Python version of the Linux kernel coming?

    I think I'll continue to do my core development in C and assembly, thanks. -Every systems hacker worth their salt.

  178. Nope, C has never been the problem by Anonymous Coward · · Score: 0

    and never will be the problem.

    IMO, programing, the act of converting an idea into something a computer can understand, has never been a disciplined act. There are disciplined practitioners but most are not. Most code I've had to fix over the last 3+ decades was written using the noodle method, try something until it sticks, or works in this case. Then once they have a working noodle, regardless of how good it is, copy/paste and edit until it works for the next solution. A language that does bounds checking is not going to help, the errors will just get subtler.

    As for that, i'm getting tired of all the marketing pieces that follow the "oh, look, see why my favorite language is better than C! Bound checking!". Who cares. Buffer overflows and other memory related issues have other means of mitigating their affects. The fact that they can be used to execute code in an unexpected fashion is a symptom of a more basic problem. The underlying OS allows code to execute without any bounds checks to protect itself.

  179. 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.

  180. I'm calling BS... by Anonymous Coward · · Score: 0

    I've been writing C code since 1987. Even though there are lots of C++ and C# programmers out there, almost none of them could write C code. And true C will allow you write yourself into a big hole, the majority of C programmers from the 1980's who survived into the 1990's always put array bounds on their pointers.

    You need to work pretty hard to be able to do buffer overflow with C++ and C# today and that does make for lazy programmers. I didn't say it couldn't be done, I'm saying you would have to work at it to make it happen.

    If I wasn't a good programmer, I would have survived this industry for 36 years and probably have moved into management. I enjoy being a code monkey and will probably be doing it up until the day before I die.

  181. 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"
  182. 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.

  183. Re: It's not the language, you stupid jackwagons.. by Anonymous Coward · · Score: 0

    And now a new car costs $30k, and is totalled in the most minor of collisions (because replacing all the damaged sensors and deployed airbags is expensive, and undoing the mechanical damage to a crumple zone is impossible). Yes, this makes people safer, and dramatically increases costs.

    I'm not saying there aren't useful improvements, but sometimes people seem to get too carried away trying to make everything perfectly safe. A perfectly safe car would be perfectly unaffordable, and also terrible at being a car. Software development is the same way. Yes, we should use safer tools and better practices. But we shouldn't be dogmatically squealing because everything isn't being written in Rust or whatever else is popular nowadays.

    Not all risks can be reasonably avoided, and some are acceptable trade-offs.

  184. Personally I'd rather use C++ by Anonymous Coward · · Score: 0

    I'm not fond of these newer tools that allow you to build applications without really knowing what you're doing. That comes with other consequences in my mind. If you can't plan to set buffer sizes in what other regards are you failing to understand what you're programming and the best way to approach the problems you're facing? It's really not even that hard. Input validation is a thing. Don't allow a process or a user to ask for more than what's been allocated. But it does require one to dot the i and cross the t.

  185. Re: It's not the language, you stupid jackwagons.. by Anonymous Coward · · Score: 0

    And here again we have someone who can't tell the difference between cause and effect.

    ADA's lack of general prevalence isn't related to its own merits or lack thereof. Evidence? It's quite common in places where programs actually, you know, work. Reliably. As intended. That ought to tell any reasonably intelligent person a thing or two about why it's used or not.

    We can all draw our conclusions from you apparently not getting it.

  186. 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."
  187. 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.

  188. Re: It's not the language, you stupid jackwagons.. by phantomfive · · Score: 1
    --
    "First they came for the slanderers and i said nothing."
  189. 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++.

  190. Lists vs. arrays by Anonymous Coward · · Score: 0

    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

    Probably in C as well, since you would implement a list using functions.

    If you're just talking about array out-of-bounds references (which are not really the same as buffer overruns) then you can implement bounds checking on every access manually.

    That's what all the other languages do behind the scenes, anyway, even though it slows down array operations.

  191. 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.)

  192. 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.

  193. 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."
  194. 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.

  195. Re:Lousy or inexperienced programmers are the prob by Anonymous Coward · · Score: 0

    In my environment, strncpy NULL terminates a string on the Linux compiler, but not the Windows compiler. So we have a macro around strncpy that always writes a NULL character at the end. It's ridiculous we have to use a macro!

  196. Soooo, JavaScript is the best Language? by Anonymous Coward · · Score: 0

    Soooo, JavaScript is the best Language?