[Static Analysis][Result is not floating-point] In function WAVTrackDemuxer::Duration

RESOLVED FIXED in Firefox 47

Status

()

RESOLVED FIXED
3 years ago
2 years ago

People

(Reporter: andi, Assigned: andi)

Tracking

(Blocks: 1 bug, {coverity})

Trunk
mozilla47
coverity
Points:
---

Firefox Tracking Flags

(firefox47 fixed)

Details

(Whiteboard: CID 1353467)

MozReview Requests

()

Submitter Diff Changes Open Issues Last Updated
Loading...
Error loading review requests:

Attachments

(1 attachment)

(Assignee)

Description

3 years ago
The Static Analysis tool Coverity added even though variable |usPerDataChunk| is declared as double it's attributed value will not be a floating point since no operand is a floating point type:

>>  const double usPerDataChunk = USECS_PER_S * mSamplesPerChunk /
>>                                mSamplesPerSecond;
>>  return TimeUnit::FromMicroseconds(aNumDataChunks * usPerDataChunk);

The result will be loss of fractional value.
(Assignee)

Comment 1

3 years ago
Created attachment 8721936 [details]
MozReview Request: Bug 1250083 - make sure value attributed to usPerDataChunk is floating point value. r=cpearce

Review commit: https://reviewboard.mozilla.org/r/35799/diff/#index_header
See other reviews: https://reviewboard.mozilla.org/r/35799/
Attachment #8721936 - Flags: review?(cpearce)
Component: Audio/Video → Audio/Video: Playback
Attachment #8721936 - Flags: review?(cpearce) → review+
Comment on attachment 8721936 [details]
MozReview Request: Bug 1250083 - make sure value attributed to usPerDataChunk is floating point value. r=cpearce

https://reviewboard.mozilla.org/r/35799/#review32747

Thanks!

::: dom/media/wave/WaveDemuxer.cpp:430
(Diff revision 1)
> -  const double usPerDataChunk = USECS_PER_S * mSamplesPerChunk /
> +  const double usPerDataChunk = USECS_PER_S * (double)mSamplesPerChunk /

C++ style case, i.e.:

static_cast<double>(mSamplesPerChunk)
(Assignee)

Updated

3 years ago
Attachment #8721936 - Attachment description: MozReview Request: Bug 1250083 - make sure value attributed to usPerDataChunk is floating point value. r?cpearce → MozReview Request: Bug 1250083 - make sure value attributed to usPerDataChunk is floating point value. r=cpearce
(Assignee)

Comment 3

3 years ago
Comment on attachment 8721936 [details]
MozReview Request: Bug 1250083 - make sure value attributed to usPerDataChunk is floating point value. r=cpearce

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/35799/diff/1-2/
(Assignee)

Comment 4

3 years ago
Comment on attachment 8721936 [details]
MozReview Request: Bug 1250083 - make sure value attributed to usPerDataChunk is floating point value. r=cpearce

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/35799/diff/2-3/

Comment 6

3 years ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/80bce7740b80
Status: NEW → RESOLVED
Last Resolved: 3 years ago
status-firefox47: affected → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla47
> > -  const double usPerDataChunk = USECS_PER_S * mSamplesPerChunk /
> > +  const double usPerDataChunk = USECS_PER_S * (double)mSamplesPerChunk /
> 
> C++ style case, i.e.:
> 
> static_cast<double>(mSamplesPerChunk)

FWIW, I would have done |double(mSamplesPerChunk)|.
You need to log in before you can comment on or make changes to this bug.