aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-02-17 19:28:11 +0100
committerMax Kellermann <max@duempel.org>2009-02-17 19:28:11 +0100
commit66b4a3ab2eb69a048457b7e57374871914fd832d (patch)
treeb8a1fc702bcb72f6a64fbe0660e64c37da52cd7b
parent8edd4079186c951c3b3b6670a289b53ffcec963d (diff)
downloadmpd-66b4a3ab2eb69a048457b7e57374871914fd832d.tar.gz
mpd-66b4a3ab2eb69a048457b7e57374871914fd832d.tar.xz
mpd-66b4a3ab2eb69a048457b7e57374871914fd832d.zip
faad: converted length check to assertion in adts_check_frame()
adts_check_frame() must not be called with a buffer length smaller than 8. We can eliminate that duplicate check, and convert it into an assertion.
-rw-r--r--src/decoder/faad_plugin.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/decoder/faad_plugin.c b/src/decoder/faad_plugin.c
index 77d12066c..cb18a9583 100644
--- a/src/decoder/faad_plugin.c
+++ b/src/decoder/faad_plugin.c
@@ -95,8 +95,7 @@ static const unsigned adts_sample_rates[] =
static size_t
adts_check_frame(struct faad_buffer *b)
{
- if (b->length <= 7)
- return 0;
+ assert(b->length >= 8);
/* check syncword */
if (!((b->data[0] == 0xFF) && ((b->data[1] & 0xF6) == 0xF0)))
@@ -122,7 +121,7 @@ adts_find_frame(struct faad_buffer *b)
if (p > b->data)
faad_buffer_shift(b, p - b->data);
- if (b->length <= 7)
+ if (b->length < 8)
/* not enough data yet */
return 0;