Closed
Bug 620164
Opened 10 years ago
Closed 9 years ago
nsTheoraState::MaxKeyframeOffset doesn't need to use MulOverflow
Categories
(Core :: Audio/Video, defect)
Tracking
()
RESOLVED
FIXED
mozilla14
People
(Reporter: timeless, Assigned: abhishekbh)
References
(Blocks 1 open bug)
Details
(Keywords: coverity)
Attachments
(1 file, 3 obsolete files)
1.18 KB,
patch
|
cpearce
:
review+
|
Details | Diff | Splinter Review |
# media/libtheora/include/theora/theora.h * line 214 -- ogg_uint32_t fps_denominator; /**< frame rate denominator **/ # media/libtheora/include/theora/codec.h * line 241 -- ogg_uint32_t fps_denominator; 264 nsTheoraState::MaxKeyframeOffset() 265 { 271 PRInt64 frameDuration; 272 PRInt64 keyframeDiff; 273 274 PRInt64 shift = mInfo.keyframe_granule_shift; 275 276 // Max number of frames keyframe could possibly be offset. 277 keyframeDiff = (1 << shift) - 1; 278 279 // Length of frame in ms. 280 PRInt64 d = 0; // d will be 0 if multiplication overflows. as fps_denominator is 32bit, there's no need to use MulOverflow: 281 MulOverflow(1000, mInfo.fps_denominator, d); 282 frameDuration = d / mInfo.fps_numerator; 283 284 // Total time in ms keyframe can be offset from any given frame. 285 return frameDuration * keyframeDiff; 286 }
Assignee | ||
Comment 1•9 years ago
|
||
I'd like to take on this bug if no one else was eyeing it.
Updated•9 years ago
|
Status: NEW → ASSIGNED
Assignee | ||
Comment 3•9 years ago
|
||
This bug has been fixed in the mozilla hg repository by a commit that was unknown to me. In my opinion it can be closed, however the patch that I had produced for it is available here: https://github.com/abhishekbh/mozilla-central/commit/5107348bd0fd66a96a9db4587bdc6c05d25d2926 I'm attaching it to the bug just in case it is needed in the future.
Comment 4•9 years ago
|
||
Bug 601535 converted a bunch of code, including this, from the hand-rolled *Overflow functions to CheckedInt. So the code is different, but it looks like it still uses CheckedInt in a place where it's unnecessary (per timeless's analysis in comment 0).
Assignee | ||
Comment 5•9 years ago
|
||
Attachment #613489 -
Flags: review?(cpearce)
Assignee | ||
Comment 6•9 years ago
|
||
Ah indeed Matthew. I've updated a patch without CheckedInt.
Comment 7•9 years ago
|
||
Comment on attachment 613489 [details] [diff] [review] Removing CheckedInt and Muloverflow from nsTheoraState::MaxKeyframeOffset Review of attachment 613489 [details] [diff] [review]: ----------------------------------------------------------------- ::: content/media/ogg/nsOggCodecState.cpp @@ +355,5 @@ > PRInt64 keyframeDiff = (1 << mInfo.keyframe_granule_shift) - 1; > > // Length of frame in usecs. > + PRInt64 d = 0; > + d = PRInt64(mInfo.fps_denominator) * USECS_PER_S; Do you need the cast to silence a warning? You don't on Windows at least... We don't really need the temporary variable "d" anymore, can you instead eliminate "d" and make that: frameDuration = (mInfo.fps_denominator * USECS_PER_S) / mInfo.fps_numerator; That makes the code a little simpler. Thanks!
Assignee | ||
Comment 8•9 years ago
|
||
Attachment #613493 -
Flags: review?(cpearce)
Comment 9•9 years ago
|
||
Comment on attachment 613493 [details] [diff] [review] 620164 - Removing CheckedInt and Muloverflow from nsTheoraState::MaxKeyframeOffset; r=reviewers Review of attachment 613493 [details] [diff] [review]: ----------------------------------------------------------------- Thanks!
Attachment #613493 -
Flags: review?(cpearce) → review+
Updated•9 years ago
|
Keywords: checkin-needed
Assignee | ||
Comment 10•9 years ago
|
||
Ah sure. I thought it was considered better to break up long lines of code, but I suppose extra variable don't help anyone.
Attachment #613489 -
Attachment is obsolete: true
Attachment #613493 -
Attachment is obsolete: true
Attachment #613494 -
Flags: review?(cpearce)
Attachment #613489 -
Flags: review?(cpearce)
Updated•9 years ago
|
Keywords: checkin-needed
Comment 11•9 years ago
|
||
Actually, before we set checkin-needed, you need to change the commit message to match the guidelines and re-uploadyour patch: Guidelines: http://blog.bonardo.net/2010/06/22/so-youre-about-to-use-checkin-needed i.e. "Bug 620164 - Removing CheckedInt and Muloverflow from nsTheoraState::MaxKeyframeOffset. r=cpearce"
Assignee | ||
Comment 12•9 years ago
|
||
Removing CheckedInt and Muloverflow from nsTheoraState::MaxKeyframeOffset
Attachment #613494 -
Attachment is obsolete: true
Attachment #613731 -
Flags: review?(cpearce)
Attachment #613494 -
Flags: review?(cpearce)
Updated•9 years ago
|
Attachment #613731 -
Flags: review?(cpearce) → review+
Updated•9 years ago
|
Keywords: checkin-needed
Comment 13•9 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/a5d3abd78272 Thanks for the patch! If you're ever looking for more bugs to work on, feel free to drop by #developers on irc.mozilla.org.
Comment 14•9 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/a5d3abd78272
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Updated•3 years ago
|
Blocks: coverity-analysis
You need to log in
before you can comment on or make changes to this bug.
Description
•