Am I the only one to be annoyed by this...? while (this->m_fBladeAngle > 6.2831855) { this->m_fBladeAngle = this->m_fBladeAngle - 6.2831855; } Like, "let's just write a while loop that could turn into an infinite loop coz I'm too lazy to do a division"
for real. The author clearly never heard of fmod
How a 20 year old bug in GTA San Andreas surfaced in Windows 11 24H2
251–260 of 315 posts
Re: How a 20 year old bug in GTA San Andreas surfaced in Windows 11 24H2
#252Re: How a 20 year old bug in GTA San Andreas surfaced in Windows 11 24H2
#253> all these findings prove that the bug is NOT an issue with Windows 11 24H2, as things like the way the stack is used by internal WinAPI functions are not contractual and they may change at any time, with no prior notice. This reminds me of an excellent article I read a while back, the gist of it was that, given sufficient success, there's no such thing as a private API.
Re: How a 20 year old bug in GTA San Andreas surfaced in Windows 11 24H2
#254Earlier quoted context omitted.
There are various compiler options like -ftrivial-auto-var-init to initialize uninitialized variables to specific (or random) values in some situations, but overall, randomizing (or zeroing) the full content of the stack in each function call would be a horrendous performance regression and isn't done for this reason.
There are fast instructions (e.g., REP STOSx, AVX zero stores, dc zva) and tricks (MTE, zero pages), but no magic CPU instruction exists that transparently and efficiently randomizes or zeros the stack on function calls. You think there would be one and I bet there are on some specialized high-security systems, but I'm not sure even where you would find such a product. Telecom certainly isn't it.
Re: How a 20 year old bug in GTA San Andreas surfaced in Windows 11 24H2
#255Earlier quoted context omitted.
There are fast instructions (e.g., REP STOSx, AVX zero stores, dc zva) and tricks (MTE, zero pages), but no magic CPU instruction exists that transparently and efficiently randomizes or zeros the stack on function calls. You think there would be one and I bet there are on some specialized high-security systems, but I'm not sure even where you would find such a product. Telecom certainly isn't it.
You couldn't do random, but with a predictable performance hit to memory, cache and write-line use stack addresses COULD be isolated for a program, for a library, etc. It'd be expensive though; every context switch would require it's own stack and pushing / restoring one more register. There's GOOD reason programs don't work that way and are supposed to not rely on values outside of properly initialized (and not late…
Re: How a 20 year old bug in GTA San Andreas surfaced in Windows 11 24H2
#256Re: How a 20 year old bug in GTA San Andreas surfaced in Windows 11 24H2
#257Re: How a 20 year old bug in GTA San Andreas surfaced in Windows 11 24H2
#258LOL!
Re: How a 20 year old bug in GTA San Andreas surfaced in Windows 11 24H2
#259My takeaway, speaking as someone who leans towards functional programming and immutability, is "this is yet another example of a mutability problem that could never happen in a functional context" (so, for example, this bug would have never been created by Rust unless it was deeply misused)
The constant rust evangelism on this site is such a turn off from actually wanting to use the language.
Re: How a 20 year old bug in GTA San Andreas surfaced in Windows 11 24H2
#260My takeaway, speaking as someone who leans towards functional programming and immutability, is "this is yet another example of a mutability problem that could never happen in a functional context" (so, for example, this bug would have never been created by Rust unless it was deeply misused)
And that's not to mention the uncomfortable truth that while doing this correctly in something like Rust may very well take less effort overall than in C++, that is not the bar we are aiming to clear. They wanted to implement something that was correct-enough, and given that this bug wasn't hit for 20+ years and that the game was a roaring success on all the major platforms - I think that was the right decision.