Fix buffer over-run in Snappy encoder

Caused by a copy action leaving less than 4 bytes available.  Also includes a regression test for this issue.