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.
This commit is contained in:
Max Kellermann 2009-02-17 19:28:11 +01:00
parent 8edd407918
commit 66b4a3ab2e

View File

@ -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;