Skip to content

Commit

Permalink
mpg123: Fix integer overflows. Closes: #291.
Browse files Browse the repository at this point in the history
  • Loading branch information
jlindgren90 committed May 14, 2013
1 parent 264d8ea commit ccacc2d
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/mpg123/mpg123.c
Expand Up @@ -401,7 +401,7 @@ static bool_t mpg123_playback_worker (InputPlayback * data, const char *
pthread_mutex_unlock (& mutex);

int64_t frames_played = 0;
int64_t frames_total = (stop_time - start_time) * ctx.rate / 1000;
int64_t frames_total = (int64_t) (stop_time - start_time) * ctx.rate / 1000;

while (1)
{
Expand All @@ -415,16 +415,15 @@ static bool_t mpg123_playback_worker (InputPlayback * data, const char *

if (ctx.seek >= 0)
{
if (mpg123_seek (ctx.decoder, (int64_t) ctx.seek * ctx.rate / 1000,
SEEK_SET) < 0)
if (mpg123_seek (ctx.decoder, (int64_t) ctx.seek * ctx.rate / 1000, SEEK_SET) < 0)
{
fprintf (stderr, "mpg123 error in %s: %s\n", filename,
mpg123_strerror (ctx.decoder));
}
else
{
data->output->flush (ctx.seek);
frames_played = (ctx.seek - start_time) * ctx.rate / 1000;
frames_played = (int64_t) (ctx.seek - start_time) * ctx.rate / 1000;
outbuf_size = 0;
}

Expand Down

0 comments on commit ccacc2d

Please sign in to comment.