Python is memory safe? Can’t you access/address memory with C bindings?

  • onlinepersona@programming.dev
    link
    fedilink
    English
    arrow-up
    0
    ·
    4 months ago

    Mr Stroustrup can spin it however he likes, but 70% of CVEs are caused by memory errors in unsafe languages like C and C++. That isn’t happening because the majority of their devs are idiots. The language is the problem.

    Talking about “but there are tools” and “hold on a minute, there a ways to write safe C++” is missing. It’s way too easy to write memory unsafe code in C++. The opposite is true of other languages and that’s why they are being recommended (dare I say pushed) over C++. To write memory unsafe Rust for example, you really, really have to want to.

    C++ is his baby, Of course he won’t acknowledge it and it was entirely predictable he would blame the programmers. The language will be the equivalent of COBOL in a decade or two.

    CC BY-NC-SA 4.0

    • zik@lemmy.world
      link
      fedilink
      arrow-up
      0
      ·
      4 months ago

      But also, only 30% of breaches are caused by memory errors. That’s because most CVEs related to memory errors don’t result in as many real life breaches as non memory error related ones. Presumably because this class of vulnerabilities is harder to exploit than ones due to logic errors.

      So assuming you could reduce the number of memory error related exploits to zero by avoiding c++, you’d only reduce exploits by 30%. That’s still a great result but not anything like the 70% implied here.

      • Black616Angel@feddit.de
        link
        fedilink
        arrow-up
        0
        ·
        4 months ago

        Yes, right. We could completely erase one third of exploitable vulnerabilities (by your numbers) only by switching to modern languages.

        There is no good argument against that. Why wait for C or C++ to try and implement get another weird “solution” for those problems? (That no one uses then anyway)

        • zik@lemmy.world
          link
          fedilink
          arrow-up
          0
          ·
          4 months ago

          Strawman argument. I’m not suggesting any of those things you made up.

          I’m just saying that you can’t claim a program’s “memory safe” when it’s not. If a Rust program has zero unsafe blocks and uses zero unsafe libraries you can say it’s memory safe. Otherwise it’s not.

    • Technus@lemmy.zip
      link
      fedilink
      arrow-up
      0
      ·
      4 months ago

      If “just don’t be an idiot” worked in the real world we wouldn’t have any need for laws or safety regulations or certifications. It’s not and never has been a compelling argument.

      Writing C++ is like walking around a construction site without a hard hat and going “ah I don’t need it, I’ll just make sure nothing falls on my head.” Yeah sure, buddy, we’ll make sure that’s written on your tombstone.