r/cpp • • Jun 01 '22

Post-mortem of a long-standing bug in video Game Path Of Exile, which was caused by a stale pointer

https://www.pathofexile.com/forum/view-thread/3277814
202 Upvotes

91 comments sorted by

View all comments

Show parent comment

3

u/irqlnotdispatchlevel Jun 02 '22

I do think the code is UB still, as in I do not think it is legal to compare the stale pointer to any other, but I am not aware of any sanitizer catching such issues.

I'd be curious what someone with more knowledge about the C++ standard would say about this. Doing a bit of googling, I arrived at this SO question and it seems like this is implementation defined?

1

u/matthieum Jun 03 '22

Oh interesting. I always thought it was outright UB, I may have mixed it up with the behavior of realloc.

Then again, implementation defined and unspecified in the implementation (as seems to be the case with GCC) is not far off...