mozilla/rr — pull request #1356 by froydnj (2014-10-22 15:11:27+00:00)
Title: fix replaying zero-length reads

The problem here is that AutoRestoreScratch assumes that:

```
data.resize(num_bytes/*=0*/);
iter = data.data();
```

results in a non-nullptr |iter|. Since `scratch_used()` assumes the nullptr-ness of `iter` determines whether we have used scratch memory, we didn't properly restore the original buffer pointer for zero-length reads, leading to replay failures.

Theoretically, 0-length `recv` as implemented by `socketcall` suffers from the same problem. But I couldn't figure out how to write a test that would exercise this, since we're always allocating scratch space for the `socketcall` argument buffer, and therefore the `scratch_used()` check always returns true. `recvfrom` seems to not suffer from this bug.