Skip to content

Return a slice when querying contents of a typed array#705

Open
simonwuelker wants to merge 2 commits into
servo:mainfrom
simonwuelker:typedarray-slice
Open

Return a slice when querying contents of a typed array#705
simonwuelker wants to merge 2 commits into
servo:mainfrom
simonwuelker:typedarray-slice

Conversation

@simonwuelker

@simonwuelker simonwuelker commented Feb 15, 2026

Copy link
Copy Markdown
Member

In rust there is no need to pass (*mut T, usize) around, as that is just a *mut [T]. This makes out-of-bounds access to typed arrays harder to do by accident.

Testing: Behaviour should be unchanged, no new tests are written
Companion PR: servo/servo#42688

@sagudev sagudev left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but such change should get companion PR in servo before landing (so we do not land something that borks servo).

CI is blocked by jidicula/clang-format-action#267

@simonwuelker

Copy link
Copy Markdown
Member Author

LGTM, but such change should get companion PR in servo before landing (so we do not land something that borks servo).

CI is blocked by jidicula/clang-format-action#267

Servo currently depends on the crates.io version of mozjs and I think we want to keep it that way - is releasing a new version for this change okay?

This is a breaking change, but it doesn't require any changes to servo.

@sagudev

sagudev commented Feb 17, 2026

Copy link
Copy Markdown
Member

LGTM, but such change should get companion PR in servo before landing (so we do not land something that borks servo).
CI is blocked by jidicula/clang-format-action#267

Servo currently depends on the crates.io version of mozjs and I think we want to keep it that way - is releasing a new version for this change okay?

This is a breaking change, but it doesn't require any changes to servo.

Yes, that's okay.

@simonwuelker

Copy link
Copy Markdown
Member Author

I've opened servo/servo#42688

@jschwe

jschwe commented Feb 26, 2026

Copy link
Copy Markdown
Member

@simonwuelker This will need a rebase

@simonwuelker

Copy link
Copy Markdown
Member Author

rebased.

This makes out-of-bounds access to typed arrays harder to do by
accident.

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants