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

Avoid invalidating pointer #79

Merged
merged 1 commit into from
Jan 14, 2023
Merged

Avoid invalidating pointer #79

merged 1 commit into from
Jan 14, 2023

Conversation

siddhesh
Copy link
Contributor

Decrementing io when it is at the start of the object sends it out of bounds, thus invoking undefined behaviour. Always increment the pointer instead.

Resolves: #78

@jakubjelinek
Copy link

IMHO if you do this (which LGTM), then you should also do the same thing with step increments/decrements,
as there is just one spot where you want to increment it and one spot where you don't, moving it from for increment
expression to before continue and removing the decrement is better.

Decrementing io when it is at the start of the object sends it out of
bounds, thus invoking undefined behaviour.  Always increment the pointer
instead.

Resolves: #78
@siddhesh
Copy link
Contributor Author

IMHO if you do this (which LGTM), then you should also do the same thing with step increments/decrements, as there is just one spot where you want to increment it and one spot where you don't, moving it from for increment expression to before continue and removing the decrement is better.

Done, thanks.

@dk
Copy link
Owner

dk commented Jan 13, 2023

@ppisar could you confirm that this doesn't coredump on your setup?

@dk dk merged commit ebcdf7d into dk:master Jan 14, 2023
@dk
Copy link
Owner

dk commented Jan 14, 2023

Thank you Siddhesh

@ppisar
Copy link
Contributor

ppisar commented Jan 16, 2023

I confirm this commit fixes the abort on my system.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants