Skip to content

Commit

Permalink
Patch to address potential integer overflow
Browse files Browse the repository at this point in the history
Static analysis (coverity) detected that some of the math
in the routine getLatency was performed in 32 bit arithmetic,
even though the result was 64 bits. This could result in an
(theoretical) integer overflow. Cast to 64 bits to fix the
defect.

Note that a quick check (perhaps wrong) showed that this
method was never called, so this is probably an irrelevant
identified defect.

Fixes coverity 700584
(cherry picked from commit 499584e)

Fixes #11595

Signed-off-by: Stuart Morgan <smorgan@mythtv.org>
  • Loading branch information
garybuhrmaster authored and stuartm committed Jun 15, 2013
1 parent 9861412 commit a08ece5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mythtv/libs/libmythfreesurround/freesurround.cpp
Expand Up @@ -493,7 +493,7 @@ long long FreeSurround::getLatency()
// returns in usec
if (latency_frames == 0)
return 0;
return decoder ? ((latency_frames + in_count)*1000000)/(2*srate) : 0;
return decoder ? ((long long)(latency_frames + in_count)*1000000)/(2*srate) : 0;
}

void FreeSurround::flush()
Expand Down

0 comments on commit a08ece5

Please sign in to comment.