-
Use of Goto in Systems Code
The goto wars of the 1960s and 1970s are long over, and goto is dead—except that it isn’t. It has a number of legitimate uses in well-structured code including an idiom seen in systems code where a failure partway through a sequence of stateful operations necessitates unwinding the operations that have already completed. For example:…
-
Nobody Expects the Spanish Inquisition, or INT_MIN to be Divided by -1
INT_MIN % -1 and INT_MIN / -1 in C/C++ are little gifts that keep on giving. Recently, Xi Wang has been using this construct to knock over languages implemented in C/C++. Then today Tavis Ormandy posted an excellent local DOS for a Windows 8 machine. But the fun doesn’t stop there. For one thing, as…
-
C and C++ Aren’t Future Proof
A C or C++ program is expected to follow a collection of rules such as “don’t access out-of-bounds array elements.” There are a lot of these rules and they are listed (or are implicit) in the various language standards. A program that plays by all of these rules—called a conforming program—is one where we might, potentially,…
-
Hiding Bugs from Branch Coverage
It’s hard to know when a piece of software has been sufficiently tested. Code coverage metrics are a partial answer. Basically, a coverage metric is a function that maps each execution to a set of coverage targets. For example, if we are performing function coverage, then the universe of targets is comprised of functions from…
-
When Software Ages Badly
In some respects, software ages gracefully: it generally starts out working poorly but gets better over time as bugs are fixed. Unlike hardware, there’s no physical wearing out of parts. This post is about a few ways in which software doesn’t get better with age. In The Mythical Man Month Brooks observes that any sufficiently complex software…
-
Operant Conditioning by Software Bugs
Have you ever used a new program or system and found it to be obnoxiously buggy, but then after a while you didn’t notice the bugs anymore? If so, then congratulations: you have been trained by the computer to avoid some of its problems. For example, I used to have a laptop that would lock…
-
Is the Browser the New OS?
Yes, this is an old question. I still think it’s interesting. Disclaimer: I haven’t tried out a Chromebook yet. First, let’s look at the situation as of late 2012. The applications I use generally fall into three categories: Web-based. Native, but easily available on Windows, Mac, and Linux. These include a file browser, a shell, Emacs,…
-
Oracles for Random Testing
Random testing is a powerful way to find bugs in software systems. However, to actually find a bug it’s necessary to be able to automatically tell the difference between a correct and an incorrect execution of the system being tested. Sometimes this is easy: we’re just looking for crashes. On the other hand, there are…
-
How Does Formal Verification Affect Software Testing?
This has been a difficult piece to write and I’ve already deleted everything and started over more than once. So, I’m going to take the easy way out and structure it as a sequence of questions and answers. What does formal verification mean? Something like “using mathematical techniques to convincingly argue that a piece of…