Avoid extra allocations in ensureBuffer() caused by an off-by-one error.
Merge pull request #4382 from nnethercote/off-by-one

Avoid extra allocations in ensureBuffer() caused by an off-by-one error.