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

array_iter_base::advance Should Take a ssize_t #267

Open
nhusung opened this issue Aug 11, 2023 · 1 comment
Open

array_iter_base::advance Should Take a ssize_t #267

nhusung opened this issue Aug 11, 2023 · 1 comment

Comments

@nhusung
Copy link

nhusung commented Aug 11, 2023

I recently had an issue with Adiar, which uses TPIE. Running the example with clang’s undefined behavior sanitizer revealed unsigned overflows when computing offsets in the following method:

void advance(size_t n) {if (forward) elm += n; else elm -= n;}

The overflow happens e.g. in case of n = (size_t) -1. Using ssize_t (i.e. the signed version of size_t) as argument seems to fix the issue.

@nhusung
Copy link
Author

nhusung commented Aug 11, 2023

(I don’t know if this issue is related to my original problem, though.)

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

No branches or pull requests

1 participant