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 - Fix for crash in test/torturethread
Summary: Fix for crash in test/torturethread
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: thread (show other bugs)
Version: HG 1.2
Hardware: All All
: P2 normal
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-03-25 03:33 UTC by Christian Walther
Modified: 2006-04-12 10:26 UTC (History)
0 users

See Also:


Attachments
Proposed patch (514 bytes, patch)
2006-03-25 03:34 UTC, Christian Walther
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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!