Change Buffer.sub to handle out-of-bounds offsets

Aligns it with the Lua string counterpart.