The Bugs We Have to Kill [pdf]
usenix.org
usenix.org
For one, they claim that CompCert doesn't have a formally verified C parser, but it does, as of 2014. Instead of citing the CompCert release page, they cite a paper written in 2011 that says that CompCert does not have a verified parser.
The concerns about proofs in Hoare logic (they also don't get the notation for Hoare triples right...) are mis-guided as well. The way that type checking works in strong, statically typed languages, the conditions they worry about don't arise by construction. They say that isn't possible, but it totally is possible and is done in projects like CompCert, bedrock, and some Haskell frameworks.
Also, they say that Heartbleed is a parser error. I don't see how, because the heartbeat message is perfectly well formed, the size of the data requested is larger than the size of the buffer. How is this a parser error? The patch wasn't a change in parser behavior either, so...
If multiple copies of the same redundant information are not identical, then that is definitely a case of invalid input.
I try to address this class of parser vulnerability with my Nail parser generator (OSDI '14 , github.com/jbangert/nail ), which is inspired by Meredith's hammer.
edit: This article almost perfectly articulates why I'm so furious at the entire web-as-a-platform movement. If you want general computation lets develop a platform for it that is isolated and doesn't try to turn what should be nothing more than text into a full blown programming language. The browser should be (good luck getting it back there) for viewing and retrieving data, not executing that data.
i'm genuinely interested in what a modern version of that would look like.
recently i watched a 1992 interview [0] with brewster kahle in which he described WAIS (wide area information server) [1].
aside: i've not used WAIS, nor do i feel it is the way forward.
my understanding is that WAIS provided a client-side interface to a directory of servers. it also seems the presentation of content was simple: mostly text, but some images and video, too. this appeals to me because after more than 20 years on the web i struggle to remember what it was like when (or even if) the majority of pages i visited were focused on delivering pure content.
don't get me wrong -- i'm fortunate to have access to the web and a way to search for information -- but i'm becoming increasingly frustrated with the quality of today's content.
i'll concede SERP SPAM is a hard nut to crack, but that doesn't stop me from cringing every time i click on a dodgy question/answer aggregation site or some wholesale ripoff of another site [2].
and less dodgy but arguably more frustrating are legitimate publishers who modify their content presentation strategy based on google algorithm updates. for example, i can't tell you how many times i've searched for a simple recipe but the top SERP was a slideshow instead of a simple recipe i could print out and place on my counter top.
lastly, over the past 20 years it seems like primary content has become a secondary citizen on the web. when i visit SERPs today it feels like i'm less likely to be presented with what i actually searched for. instead, i'm increasingly bombarded with "SIGN UP NOW!" mortars .. erm modals .. and the presentation of the content i searched for feels more like Dahala Khagrabari [3] than the main reason for my page visit.
one might read the above and conclude i'm a bitter luddite. quite the contrary, i feel blessed to be alive and am optimistic (mostly ;) WRT the future of IT. however, i am concerned with (what seems like) this generation's tendency to favor presentation over information. the older i get the less patience i have for popups/modals, slideshows, and pictures-because-google-likes-pictures; just gimme my goddamned information already.
so. i'd really like to see a dumb client-side app that gives me only what i want to see. i've tried lynx/w3m-emacs/etc. but JavaScript ruined that effort. keen for alternative suggestions :)
[0] https://archive.org/details/brewster_kahle_interview_1992
[1] https://en.wikipedia.org/wiki/Wide_area_information_server
[2] http://stuccy.com/ is a wholesale ripoff of stackoverflow. (note: i don't recommend visiting this site; who knows what they're up to.) i've emailed SO, whose response was essentially this:
> Please note, bringing these sites into compliance (or getting them to no longer serve our content) is often a long and arduous process. You may not see immediate results. However, rest assured that we're working on it.
Well, how many languages (or data formats) are SLL(k)? SQL is not, for example. A context-free grammar for SQL accepts "INSERT INTO example (a, b) VALUES ('test');". You need an additional check to find that you specify two columns to insert, but provide only one value.
This is common practice: Have a context-free grammar which accepts a superset of the actual language and filter it afterwards. Maybe you can fit the grammar more to the language, but it becomes quite ugly and big then. I don't think it is a good idea that we try to avoid the filter-afterwards and use big grammars, which we implement with shiny verification tools.
You are correct that the lexer pass allows you to expand a language despite the use of a context-free grammar in the parser. Significant whitespace lexed as indent/dedent tokens is a common example.
Not only we should have verified parser, but also verified serializers.
http://m1el.github.io/printf-antipattern/
(EDIT: I know it is badly written and there are errors, but, I'm looking forward to rewriting it)
It's impractical and error-prone to do so, of course, but that's not a computability issue. You could write a compiler, if you really wanted to, that took a context-free grammar plus an integer specifying maximum production depth, and mechanically converted it to an FSM or regex. Therefore I think the article is barking up the wrong tree with computability; the issue isn't what's computable by a finite vs. pushdown automaton, but that parsing nested data structures with regexes is virtually impossible to do correctly.
But this is a technicality and it should in no way indicate that a regex for HTML would be a good idea.
Say you had a recursive data structure with a very small maximum nesting depth, like 5. Should you use a regex then? I would argue still no: there's no computational problem, but writing a correct regex to do so is still bug-prone. At least, writing one manually is. In the case of small finite nesting depths there might occasionally be reasons to mechanically compile something that looks more like EBNF to a DFA or NFA. But something else might well be better. At that point it's just an efficiency question.
Basic regular expressions cannot, but regexes actually can. PCRE pioneered the technique AFAIK, and it later spread to Perl, Python, Ruby and other runtimes. Perl has this feature called lazy regular subexpressions which can be used to evaluate Perl expressions upon matching a subexpression, thus giving you the ability to recurse.
On that note, once you can run arbitrary functions on your matches, you could match /.*/ and then the function you run is html5lib.parse. Is that still a regular expression?