We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 182

Summary: Fix for crash in test/torturethread
Product: SDL Reporter: Christian Walther <cwalther>
Component: threadAssignee: Ryan C. Gordon <icculus>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: HG 1.2   
Hardware: All   
OS: All   
Attachments: Proposed patch

Description Christian Walther 2006-03-25 03:33:26 UTC
test/torturethread crashes on Mac OS X (PPC and i386), and I'm expecting it to crash on other platforms as well. The problem is that in the last 'for(i = NUMTHREADS-1; i >= 0; --i)' loop in main(), i is unsigned, so the comparison 'i >= 0' is always true and the loop continues to run until it accesses inexistent memory.

The attached patch fixes this by doing the loop forward instead of backward. (Why was it done backward in the first place?)
Comment 1 Christian Walther 2006-03-25 03:34:27 UTC
Created attachment 94 [details]
Proposed patch
Comment 2 Sam Lantinga 2006-04-12 10:26:18 UTC
This is in CVS, thanks!