Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define the index range of a byte sequence #242

Open
GPHemsley opened this issue Mar 29, 2019 · 1 comment
Open

Define the index range of a byte sequence #242

GPHemsley opened this issue Mar 29, 2019 · 1 comment

Comments

@GPHemsley
Copy link
Member

AFAICT, it's not defined how to index into a byte sequence, but it probably should be.

The mimesniff spec already says things like "where the first byte is index 0", and I filed W3C bug 28519 with the following description:

Make explicit the fact that an index beyond the length of the sequence yields undefined.

But these things should probably come from infra, not be exclusive to mimesniff.

@domenic
Copy link
Member

domenic commented Mar 31, 2019

Note that for lists, we say

The index cannot be out-of-bounds, except when used with exists.

I.e., you should basically guard any potentially-out-bounds index access with "if x[i] exists" or "if i >= x's size"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants