Commit 66b4a3ab authored by Max Kellermann's avatar Max Kellermann

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.
parent 8edd4079
...@@ -95,8 +95,7 @@ static const unsigned adts_sample_rates[] = ...@@ -95,8 +95,7 @@ static const unsigned adts_sample_rates[] =
static size_t static size_t
adts_check_frame(struct faad_buffer *b) adts_check_frame(struct faad_buffer *b)
{ {
if (b->length <= 7) assert(b->length >= 8);
return 0;
/* check syncword */ /* check syncword */
if (!((b->data[0] == 0xFF) && ((b->data[1] & 0xF6) == 0xF0))) if (!((b->data[0] == 0xFF) && ((b->data[1] & 0xF6) == 0xF0)))
...@@ -122,7 +121,7 @@ adts_find_frame(struct faad_buffer *b) ...@@ -122,7 +121,7 @@ adts_find_frame(struct faad_buffer *b)
if (p > b->data) if (p > b->data)
faad_buffer_shift(b, p - b->data); faad_buffer_shift(b, p - b->data);
if (b->length <= 7) if (b->length < 8)
/* not enough data yet */ /* not enough data yet */
return 0; return 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment