Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Std span #1038

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

Merged
vyazelenko merged 4 commits into aeron-io:master from nbradac:std-span
Dec 16, 2024
Merged

Std span #1038

vyazelenko merged 4 commits into aeron-io:master from nbradac:std-span
Dec 16, 2024

Conversation

@nbradac
Copy link
Contributor

@nbradac nbradac commented Dec 13, 2024

This is an extension of this PR: (#1027) that only allows SBE_USE_SPAN to be set when SBE_ENABLE_SPAN is also set.

pluto699 reacted with thumbs up emoji
mspdt22 and others added 3 commits November 26, 2024 11:38
The impetus was a bug that we ran into when writing a string-literal to a fixed-width char field:
```c++
flyweight.putFixedChar("hello");
```
This is unsafe:
- If the field size is less than 6, we overrun the buffer and corrupt it.
- If the field size is more than 6, we don't zero pad the rest of it.
Instead, we build on support for the std::string_view getters and setters, which do length checking.
std::span generalizes this to fixed-width fields of all types. Notably, if the size of the std::span
is knowable at compile time, we pay no runtime cost for the length checking, and we should get
similar performance to the existing API which takes a raw pointer.
Further, we add a sbetool option to disable accepting arrays by raw pointer, which should prevent
memcpy operation without bounds checking. This is off by default to avoid a breaking change.
@vyazelenko vyazelenko merged commit ec42a79 into aeron-io:master Dec 16, 2024
36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@vyazelenko vyazelenko Awaiting requested review from vyazelenko

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /