dk / Prima

prima.eu.org
Other
106 stars 27 forks source link

Avoid invalidating pointer #79

Closed siddhesh closed 1 year ago

siddhesh commented 1 year ago

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 commented 1 year ago

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.

siddhesh commented 1 year ago

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 commented 1 year ago

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

dk commented 1 year ago

Thank you Siddhesh

ppisar commented 1 year ago

I confirm this commit fixes the abort on my system.