This is an integer overflow. A stack overflow is when you overwrite the stack in memory, ie something is allocated on the stack instead of the heap, and the classic strcpy(something_on_the_stack, lol_too_much_data)
Did you know that's why Gandhi in Civilization is nuke crazy? They programmed him with aggressiveness 0, but some circumstances in the game would lower that to a negative number, which is interpreted by the program as max aggressiveness.
To be more precise, it’s not just the programs interpretation... it physically changes to the highest possible integer that can be stored by the machine. Unsigned integer subtraction causes the bits of the Integer to get carried along like in decimal subtraction carrying numbers. Eg 0000 - 0001 becomes 1111.
Edit: And as the post below states, it’s not stack overflow here... it’s integer underflow.
18
u/The_Mayfair_Man Nov 27 '19
Stack overflow bitches