varspool/Wrench — pull request #63 by dominics (2014-11-19 11:41:05+00:00)
Title: Fix off-by-one error in deciding to exit length calculation

The foreach starting at line 271 shouldn't be entered unless it is known $this->buffer[$start] through $this->buffer[$end] is set, inclusive (this is the range in the frame that holds the payload length).

Previously, we tested if `$end > strlen($this->buffer)`. Consider the case when `$end == strlen($this->buffer)`: $this->buffer[$end] is not set (because indexes start at zero). We should therefore instead test for `$end >= strlen($this->buffer)`.

Potentially fixes #35 and #61