Skip to content

(bug) fix issues where asspan() and indexer might return out-of-range data - #323

Merged
linkdotnet merged 3 commits into
linkdotnet:mainfrom
dhhoang:bug/incorrect-span-bound-check
Oct 4, 2026
Merged

linkdotnet merged 3 commits into
linkdotnet:mainfrom
dhhoang:bug/incorrect-span-bound-check

Conversation

@dhhoang

@dhhoang dhhoang commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

Hi, I am an user of the library so I would like to contribute with some improvements.
This PR adds the range guards for AsSpan() and indexer methods.
Currently, the data was returned even if it is outside of bufferPosition range.
This PR adds a guard to make the method throws when such data is requested.

@linkdotnet

Copy link
Copy Markdown
Owner

Uhh good point - the check is (or now: was) wrong. Feel free to add yourself to CHANGELOG.md under "UNRELEASED". I can also take this over - let me know.

In any case, thanks for the contribution.

@dhhoang

dhhoang commented Oct 3, 2026

Copy link
Copy Markdown
Contributor Author

Hi @linkdotnet , I've updated the changelog. Thanks for reviewing :)

@linkdotnet
linkdotnet merged commit eab9c83 into linkdotnet:main Oct 4, 2026
1 check passed
@dhhoang
dhhoang deleted the bug/incorrect-span-bound-check branch October 4, 2026 08:58
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.

2 participants