From 824d299eb13e2fc4d03f5c4974a9c4f6511fd284 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 3 Feb 2009 22:46:00 +0100 Subject: ffmpeg: fixed seek integer overflow The "current" variable is used for calculating the seek destination, and was declared as "int". With very long song files, the 32 bit integer can overflow. ffmpeg expects an int64_t, which is very unlikely to overflow. Switch to int64_t. --- src/decoder/ffmpeg_plugin.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/decoder') diff --git a/src/decoder/ffmpeg_plugin.c b/src/decoder/ffmpeg_plugin.c index c48918067..aca02cb2a 100644 --- a/src/decoder/ffmpeg_plugin.c +++ b/src/decoder/ffmpeg_plugin.c @@ -264,7 +264,7 @@ ffmpeg_decode_internal(struct ffmpeg_context *ctx) AVPacket packet; struct audio_format audio_format; enum decoder_command cmd; - int current, total_time; + int total_time; total_time = 0; @@ -306,9 +306,10 @@ ffmpeg_decode_internal(struct ffmpeg_context *ctx) av_free_packet(&packet); if (cmd == DECODE_COMMAND_SEEK) { - current = decoder_seek_where(decoder) * AV_TIME_BASE; + int64_t where = + decoder_seek_where(decoder) * AV_TIME_BASE; - if (av_seek_frame(format_context, -1, current, 0) < 0) + if (av_seek_frame(format_context, -1, where, 0) < 0) decoder_seek_error(decoder); else decoder_command_finished(decoder); -- cgit v1.2.3