Fix BytesRangeToCharactersRange for mismatched byte buffers