aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-02-03 22:46:00 +0100
committerMax Kellermann <max@duempel.org>2009-02-03 22:46:00 +0100
commitc90552ddea9d2e19e094d68789d319a4f709667f (patch)
treedbc4ca7bebc31bbe7f9f61649095460fad307fb2
parent2c3fab848a048d6b1cdb80a3dbf98df57b5e9921 (diff)
downloadmpd-c90552ddea9d2e19e094d68789d319a4f709667f.tar.gz
mpd-c90552ddea9d2e19e094d68789d319a4f709667f.tar.xz
mpd-c90552ddea9d2e19e094d68789d319a4f709667f.zip
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.
-rw-r--r--NEWS1
-rw-r--r--src/decoder/ffmpeg_plugin.c7
2 files changed, 5 insertions, 3 deletions
diff --git a/NEWS b/NEWS
index 6956f16d7..0f571da67 100644
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,7 @@ ver 0.14.2 (2009/??/??)
- ffmpeg: added support for the tags comment, genre, year
- ffmpeg: don't warn of empty packet output
- ffmpeg: check if the time stamp is valid
+ - ffmpeg: fixed seek integer overflow
- wavpack: pass NULL if the .wvc file fails to open
- mikmod: call MikMod_Exit() only in the finish() method
* audio outputs:
diff --git a/src/decoder/ffmpeg_plugin.c b/src/decoder/ffmpeg_plugin.c
index 68994ac31..adc143a57 100644
--- a/src/decoder/ffmpeg_plugin.c
+++ b/src/decoder/ffmpeg_plugin.c
@@ -262,7 +262,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;
@@ -304,9 +304,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);