From 66b4a3ab2eb69a048457b7e57374871914fd832d Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 17 Feb 2009 19:28:11 +0100 Subject: 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. --- src/decoder/faad_plugin.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/decoder/faad_plugin.c') 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; -- cgit v1.2.3