3 ms·
I was helping a guy with some text-based game he was working on that had some pretty clever bits of code for constructing scene description text. The problem w
by hinkley 7y ago
I was helping a guy with some text-based game he was working on that had some pretty clever bits of code for constructing scene description text.
The problem was that once in a while you'd just get some garbled text on the screen.
Eventually I figured out why: Some of the sentence fragments were malloc'ed, others were returned from the stack. Once the description got over a certain number of bytes he was smashing his own stack. I say 'his' but the problem was introduced by an earlier collaborator.
Buddy, I really want to help you with this but I (much younger me) am not up for unwinding a use-after-free bug of this level of recursion. Good luck, I'm out.