From 54b6f8a4ae90ef1603b817902c12650eeb8328c6 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 11 Jul 2014 23:58:51 +0200 Subject: [PATCH] decoder/faad: test "seekable" after ADTS frame check Don't bother to check for ADIF just because the stream is not seekable. --- src/decoder/FaadDecoderPlugin.cxx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/decoder/FaadDecoderPlugin.cxx b/src/decoder/FaadDecoderPlugin.cxx index 60d95d626..aa5c6835f 100644 --- a/src/decoder/FaadDecoderPlugin.cxx +++ b/src/decoder/FaadDecoderPlugin.cxx @@ -186,9 +186,13 @@ faad_song_duration(DecoderBuffer *buffer, InputStream &is) return -1; } - if (is.IsSeekable() && length >= 2 && + if (length >= 2 && data[0] == 0xFF && ((data[1] & 0xF6) == 0xF0)) { /* obtain the duration from the ADTS header */ + + if (!is.IsSeekable()) + return -1; + float song_length = adts_song_duration(buffer); is.LockSeek(tagsize, SEEK_SET, IgnoreError());