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

Use size_t around base::span size/offset arguments #42627

Closed
cdesouza-chromium opened this issue Dec 3, 2024 · 0 comments · Fixed by brave/brave-core#26822
Closed

Use size_t around base::span size/offset arguments #42627

cdesouza-chromium opened this issue Dec 3, 2024 · 0 comments · Fixed by brave/brave-core#26822

Comments

@cdesouza-chromium
Copy link
Contributor

Description

This is an improvement that is being done by upstream, and that we should adopt as well.

@cdesouza-chromium cdesouza-chromium self-assigned this Dec 3, 2024
cdesouza-chromium added a commit to brave/brave-core that referenced this issue Dec 3, 2024
There's some tightening around values passed into span, with
`StrictNumeric<size_t>` being enforced. This is mostly unimportant when
dealing with compile-time values, as they can be validated on the spot,
however it does affect several places where the value is unknown at
runtime, and a signed value was being used.

Chromium changes:
https://chromium.googlesource.com/chromium/src/+/4937ad9ae64d9d3f05d13c9d041769432a12281b

```
commit 4937ad9ae64d9d3f05d13c9d041769432a12281b
Author: Peter Kasting <[email protected]>
Date:   Tue Nov 26 22:58:16 2024 +0000

    Use StrictNumeric<size_t> for more span methods.

    Changes subspan(), split_at(), at(), and get_at() to match pre-existing
    usage in constructors, first(), last(), etc.

    Bug: 364987728
```

Resolves brave/brave-browser#42627
cdesouza-chromium added a commit to brave/brave-core that referenced this issue Dec 3, 2024
There's some tightening around values passed into span, with
`StrictNumeric<size_t>` being enforced. This is mostly unimportant when
dealing with compile-time values, as they can be validated on the spot,
however it does affect several places where the value is unknown at
runtime, and a signed value was being used.

Chromium changes:
https://chromium.googlesource.com/chromium/src/+/4937ad9ae64d9d3f05d13c9d041769432a12281b

```
commit 4937ad9ae64d9d3f05d13c9d041769432a12281b
Author: Peter Kasting <[email protected]>
Date:   Tue Nov 26 22:58:16 2024 +0000

    Use StrictNumeric<size_t> for more span methods.

    Changes subspan(), split_at(), at(), and get_at() to match pre-existing
    usage in constructors, first(), last(), etc.

    Bug: 364987728
```

Resolves brave/brave-browser#42627
cdesouza-chromium added a commit to brave/brave-core that referenced this issue Dec 3, 2024
There's some tightening around values passed into span, with
`StrictNumeric<size_t>` being enforced. This is mostly unimportant when
dealing with compile-time values, as they can be validated on the spot,
however it does affect several places where the value is unknown at
runtime, and a signed value was being used.

Chromium changes:
https://chromium.googlesource.com/chromium/src/+/4937ad9ae64d9d3f05d13c9d041769432a12281b

```
commit 4937ad9ae64d9d3f05d13c9d041769432a12281b
Author: Peter Kasting <[email protected]>
Date:   Tue Nov 26 22:58:16 2024 +0000

    Use StrictNumeric<size_t> for more span methods.

    Changes subspan(), split_at(), at(), and get_at() to match pre-existing
    usage in constructors, first(), last(), etc.

    Bug: 364987728
```

Resolves brave/brave-browser#42627
cdesouza-chromium added a commit to brave/brave-core that referenced this issue Dec 3, 2024
There's some tightening around values passed into span, with
`StrictNumeric<size_t>` being enforced. This is mostly unimportant when
dealing with compile-time values, as they can be validated on the spot,
however it does affect several places where the value is unknown at
runtime, and a signed value was being used.

Chromium changes:
https://chromium.googlesource.com/chromium/src/+/4937ad9ae64d9d3f05d13c9d041769432a12281b

```
commit 4937ad9ae64d9d3f05d13c9d041769432a12281b
Author: Peter Kasting <[email protected]>
Date:   Tue Nov 26 22:58:16 2024 +0000

    Use StrictNumeric<size_t> for more span methods.

    Changes subspan(), split_at(), at(), and get_at() to match pre-existing
    usage in constructors, first(), last(), etc.

    Bug: 364987728
```

Resolves brave/brave-browser#42627
@brave-builds brave-builds added feature/web3/wallet Integrating Ethereum+ wallet support feature/web3/wallet/core labels Dec 3, 2024
@brave-builds brave-builds added this to the 1.75.x - Nightly milestone Dec 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants