News for hackers. Stuff that matters.
Re:Show HN: Drogon – A C++14/17 based high performance HTTP ... by ilovecaching on Tuesday March 19, 2019 @12:46AM (#19428136)
If you really want a security story, you shouldn't be looking into a C++ server. That's a very false sense of security, there is no way to guarantee memory safety.
Re:Show HN: Drogon – A C++14/17 based high performance HTTP ... by otabdeveloper2 on Tuesday March 19, 2019 @01:16AM (#19428259)
> there is no way to guarantee memory safety.

Absolutely not true for C++. The language was invented to guarantee memory safety, like Rust was. (The fact that people ignore the safety features when coding is irrelevant, people liberally throw 'unsafes' around in Rust and Haskell too.)

Re:Show HN: Drogon – A C++14/17 based high performance HTTP ... by ilovecaching on Tuesday March 19, 2019 @01:28AM (#19428302)
C++ wasn't invented to be safe in the same way as Rust or Ada, whose author's saw state of the art safety as a critical tenant of the language. Stroupsoup was, I believe, mostly interested in making C more suitable for large software engineering projects and was more interested in better abstractions, which could lead to better safety.

The fact that people can ignore the safety features is the point. Unsafe is a contract, and it only opens a small number of extra "features". It forms the axioms of a proof the your code correctly uses memory. C++ is essentially just patched with safer abstractions, some of which are major improvements, but there is no proof, no rigorous check for safety until runtime from asan or a fuzzer, or other tools that aren't a part of core C++.

The biggest issue with the safety of C++, however, is the size of the language. It has become so big and so complicated, and the rules that govern things we take for granted like function name lookups are horrendously unintuitive and lead to unintended consequences.

Re:Show HN: Drogon – A C++14/17 based high performance HTTP ... by pjmlp on Tuesday March 19, 2019 @01:55AM (#19428420)
The language was invented so that Bjarne after his experience having to rewrite Simula into BCPL, never had to go through such a low level language again in his life.

Plenty of interviews where he states this, including some of his books.

Re:Show HN: Drogon – A C++14/17 based high performance HTTP ... by Thorrez on Tuesday March 19, 2019 @01:32AM (#19428325)
When a simple

    int foo(int x) {
      return x+1;
    }
leads to undefined behavior (aka the standard says the program can delete your hard drive) if x is too big, that's not a language that guarantees memory safety.
Re:Show HN: Drogon – A C++14/17 based high performance HTTP ... by dearrifling on Tuesday March 19, 2019 @01:37AM (#19428350)
That has nothing to do with memory safety, that's just plain UB.
Re:Show HN: Drogon – A C++14/17 based high performance HTTP ... by Thorrez on Tuesday March 19, 2019 @01:54AM (#19428417)
According to the spec, it can lead to all the same problems that any UB leads to, including all the problems that any memory unsafety leads to. The code is allowed by the spec to cause memory unsafety.

But to list some direct memory unsafety possibilities: indexing off the end of an array, indexing off the end of a vector, dereferencing a bad pointer, dereferencing a null pointer, dereferencing a bad iterator, double delete.

Re:Show HN: Drogon – A C++14/17 based high performance HTTP ... by fxfan on Tuesday March 19, 2019 @01:42AM (#19428368)
How does rust handle this?
Re:Show HN: Drogon – A C++14/17 based high performance HTTP ... by Thorrez on Tuesday March 19, 2019 @01:46AM (#19428385)
I've never used rust, but from what I've heard, it crashes in debug mode, and wraps (two's complement) in release mode.
Re:Show HN: Drogon – A C++14/17 based high performance HTTP ... by vardump on Tuesday March 19, 2019 @11:58AM (#19432042)
> it crashes in debug mode, and wraps (two's complement) in release mode.

Well, that's indeed a nice feature in debug mode. Mostly wraparound is undesired and wraparound bugs are pretty common. Shame the performance cost is too much to do same in release.

Whenever wraparound semantics it is actually wanted, one can use an appropriate type.

Re:Show HN: Drogon – A C++14/17 based high performance HTTP ... by steveklabnik on Tuesday March 19, 2019 @08:38AM (#19430159)
That’s the default semantics, yes.