1 From cb2b7ce505701fd6c10c2700eb1c515f094544e8 Mon Sep 17 00:00:00 2001
2 From: Athanasios Oikonomou <athoik@gmail.com>
3 Date: Sat, 18 Nov 2017 07:57:35 +0200
4 Subject: [PATCH] ac3_descriptor: check if header is larger than descriptor
6 It seems another broadcaster got it wrong.
8 6A Tag 0x6A: AC-3_descriptor
12 In above case the descriptor length is 2 and header lenght is 3.
13 The ASSERT_MIN_DLEN fails and ac3 fails to parse.
14 Set sane defaults in this case too.
16 diff --git a/src/ac3_descriptor.cpp b/src/ac3_descriptor.cpp
17 index c7b28b2..fec8c31 100644
18 --- a/src/ac3_descriptor.cpp
19 +++ b/src/ac3_descriptor.cpp
20 @@ -31,6 +31,16 @@ Ac3Descriptor::Ac3Descriptor(const uint8_t * const buffer) : Descriptor(buffer)
21 asvcFlag = (buffer[2] >> 4) & 0x01;
23 size_t headerLength = 1 + ac3TypeFlag + bsidFlag + mainidFlag + asvcFlag;
25 + // broadcasters got it wrong again...
26 + if (headerLength > descriptorLength) {
34 ASSERT_MIN_DLEN(headerLength);