News for hackers. Stuff that matters.
Re:Writing parsers like it is 2017 by rhencke on Tuesday August 15, 2017 @08:13AM (#15017457)
It was not caused by a bug in Ragel, though.
Re:Writing parsers like it is 2017 by staticassertion on Tuesday August 15, 2017 @11:28AM (#15019121)
This is always going to lead to the same place - whether it's the developer's fault or the tool's.

The author of this post wants uncompromising safety, ragel does not allow for that - programmer error can introduce memory unsafety. They even explicitly call out Cloudbleed.

Re:Writing parsers like it is 2017 by wuch on Tuesday August 15, 2017 @08:52AM (#15017693)
To provide a little bit more context, here is detailed description of this bug [0]. Curiously, they suggest that problem could be avoided by changing the check for EOF to ">=". This is not true at all in case of C, at least as far as language semantics is concerned. When pointer goes two past the end of array you are already in undefined behaviour land.

[0] https://blog.cloudflare.com/incident-report-on-memory-leak-c...

Re:Writing parsers like it is 2017 by ioquatix on Wednesday August 16, 2017 @03:05AM (#15025498)
I think it's valid in C/C++ to go 1 past the end of an array: https://stackoverflow.com/questions/988158/take-the-address-...
Re:Writing parsers like it is 2017 by striking on Tuesday August 15, 2017 @01:15PM (#15020190)
More specifically:

> The Ragel code we wrote contained a bug that caused the pointer to jump over the end of the buffer and past the ability of an equality check to spot the buffer overrun.

Re:Writing parsers like it is 2017 by ioquatix on Wednesday August 16, 2017 @03:07AM (#15025506)
A simple `assert(p<pe);` in a debug build would have caught the issue. I think you could argue that ragel should include something like this by default.