See PR 12860; some of problem related to the PR were "fixed" by adjusting the guarantees that are specified in the documentation. Another problem was that non-consecutive bytes could be returned.