Closed
Bug 485967
Opened 16 years ago
Closed 16 years ago
Fix numeric overflow in GetPerformanceCounter for UNIX
Categories
(Tamarin Graveyard :: Garbage Collection (mmGC), defect)
Tamarin Graveyard
Garbage Collection (mmGC)
Tracking
(Not tracked)
VERIFIED
FIXED
People
(Reporter: rishah, Unassigned)
References
Details
Attachments
(1 file)
(deleted),
patch
|
treilly
:
review+
lhansen
:
review+
|
Details | Diff | Splinter Review |
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.0.7) Gecko/2009021906 Firefox/3.0.7
Build Identifier:
In GC::GetPerformanceCounter() for UNIX there is an overflow bug in following line of code
uint64_t seconds = (uint64_t)(tv.tv_sec * 1000000);
The cast to uint64_t should be applied to tv.tv_sec prior to mutiplying
Reproducible: Always
Reporter | ||
Comment 1•16 years ago
|
||
Attachment #370239 -
Flags: review?(treilly)
Reporter | ||
Updated•16 years ago
|
Attachment #370239 -
Flags: review?(lhansen)
Comment 2•16 years ago
|
||
Comment on attachment 370239 [details] [diff] [review]
[v1] patch
I don't understand the bug or why this fixes it, shouldn't the original code promote the value to 64 bits first then do the multiply?
Reporter | ||
Comment 3•16 years ago
|
||
In the original code the multiplication happens first resulting in the overflow since tv.tv_sec is "long" and then it gets converted to uint64_t.
The fix forces "long" to get converted to uint64_t and then undergo multiplication.
Comment 4•16 years ago
|
||
Oh I got it, the fix is to remove the parens, I was reading the diff backwards.
Updated•16 years ago
|
Attachment #370239 -
Flags: review?(treilly) → review+
Updated•16 years ago
|
Attachment #370239 -
Flags: review?(lhansen) → review+
Reporter | ||
Comment 5•16 years ago
|
||
Fixed changeset: 1689:1fd54b08b399
Status: UNCONFIRMED → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
Updated•15 years ago
|
Status: RESOLVED → VERIFIED
You need to log in
before you can comment on or make changes to this bug.
Description
•