aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-09-30 15:22:47 +0200
committerMax Kellermann <max@duempel.org>2009-09-30 15:22:47 +0200
commitb0f9a1454af5af826255e988d1ca8fe78df2c136 (patch)
tree2b8432de978ccc6ae7bc2aa0f48e06aeb1ca128b
parentefb290073bfecfb051a9839ec30fb5c57524640d (diff)
downloadmpd-b0f9a1454af5af826255e988d1ca8fe78df2c136.tar.gz
mpd-b0f9a1454af5af826255e988d1ca8fe78df2c136.tar.xz
mpd-b0f9a1454af5af826255e988d1ca8fe78df2c136.zip
decoder/faad: skip assertion failure on large ID3 tags
When the ID3 tag in an AAC file is larger than the current buffer, the function decoder_buffer_consume() aborts. By using the new function decoder_buffer_skip() instead, we can safely skip the ID3 tag.
-rw-r--r--NEWS1
-rw-r--r--src/decoder/faad_plugin.c8
2 files changed, 7 insertions, 2 deletions
diff --git a/NEWS b/NEWS
index b6b23942f..ecb576dde 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,7 @@
ver 0.15.4 (2009/??/??)
* decoders:
- vorbis: revert "faster tag scanning with ov_test_callback()"
+ - faad: skip assertion failure on large ID3 tags
* output:
- osx: fix the OS X 10.6 build
diff --git a/src/decoder/faad_plugin.c b/src/decoder/faad_plugin.c
index d0537dd5b..7b2806a4c 100644
--- a/src/decoder/faad_plugin.c
+++ b/src/decoder/faad_plugin.c
@@ -162,6 +162,7 @@ faad_song_duration(struct decoder_buffer *buffer, struct input_stream *is)
size_t tagsize;
const unsigned char *data;
size_t length;
+ bool success;
fileread = is->size >= 0 ? is->size : 0;
@@ -179,8 +180,11 @@ faad_song_duration(struct decoder_buffer *buffer, struct input_stream *is)
tagsize += 10;
- decoder_buffer_consume(buffer, tagsize);
- decoder_buffer_fill(buffer);
+ success = decoder_buffer_skip(buffer, tagsize) &&
+ decoder_buffer_fill(buffer);
+ if (!success)
+ return -1;
+
data = decoder_buffer_read(buffer, &length);
if (data == NULL)
return -1;