--- /dev/null
+diff --git a/src/descriptor.cpp b/src/descriptor.cpp
+index 8c914a9..beaf4d7 100644
+--- a/src/descriptor.cpp
++++ b/src/descriptor.cpp
+@@ -17,6 +17,9 @@ Descriptor::Descriptor(const uint8_t * const buffer)
+ descriptorTag = buffer[0];
+ descriptorLength = buffer[1];
+
++ if (!descriptorLength)
++ descriptorLength = 1;
++
+ dataBytes.resize(descriptorLength);
+ memcpy(&dataBytes[0], &buffer[2], descriptorLength);
+
--- /dev/null
+--- a/src/ac3_descriptor.cpp
++++ b/src/ac3_descriptor.cpp
+@@ -31,6 +31,16 @@ Ac3Descriptor::Ac3Descriptor(const uint8_t * const buffer) : Descriptor(buffer)
+ asvcFlag = (buffer[2] >> 4) & 0x01;
+
+ size_t headerLength = 1 + ac3TypeFlag + bsidFlag + mainidFlag + asvcFlag;
++
++ // broadcasters got it wrong again...
++ if (headerLength > descriptorLength) {
++ ac3TypeFlag = 0;
++ bsidFlag = 0;
++ mainidFlag = 0;
++ asvcFlag = 0;
++ return;
++ }
++
+ ASSERT_MIN_DLEN(headerLength);
+
+ size_t i = 3;
--- /dev/null
+--- a/include/dvbsi++/network_information_section.h
++++ b/include/dvbsi++/network_information_section.h
+@@ -37,6 +37,7 @@ typedef TransportStreamInfoList::const_iterator TransportStreamInfoConstIterator
+ class NetworkInformationSection : public LongCrcSection, public DescriptorContainer
+ {
+ protected:
++ unsigned networkId : 16;
+ unsigned networkDescriptorsLength : 12;
+ unsigned transportStreamLoopLength : 12;
+ TransportStreamInfoList tsInfo;
+@@ -49,6 +50,7 @@ class NetworkInformationSection : public LongCrcSection, public DescriptorContai
+ static const enum TableId TID = TID_NIT_ACTUAL;
+ static const uint32_t TIMEOUT = 12000;
+
++ uint16_t getNetworkId(void) const;
+ const TransportStreamInfoList *getTsInfo(void) const;
+ };
+
+--- a/src/network_information_section.cpp
++++ b/src/network_information_section.cpp
+@@ -35,6 +35,7 @@ uint16_t TransportStreamInfo::getOriginalNetworkId(void) const
+
+ NetworkInformationSection::NetworkInformationSection(const uint8_t * const buffer) : LongCrcSection(buffer)
+ {
++ networkId = UINT16(&buffer[3]);
+ networkDescriptorsLength = sectionLength > 9 ? DVB_LENGTH(&buffer[8]) : 0;
+
+ uint16_t pos = 10;
+@@ -68,6 +69,11 @@ NetworkInformationSection::~NetworkInformationSection(void)
+ delete *i;
+ }
+
++uint16_t NetworkInformationSection::getNetworkId(void) const
++{
++ return networkId;
++}
++
+ const TransportStreamInfoList *NetworkInformationSection::getTsInfo(void) const
+ {
+ return &tsInfo;
$(PATCH)/libdvbsi++-src-time_date_section.cpp-fix-sectionLength-check.patch; \
$(PATCH)/libdvbsi++-fix-unaligned-access-on-SuperH.patch; \
$(PATCH)/libdvbsi++-content_identifier_descriptor.patch; \
+ $(PATCH)/libdvbsi++-fix_network_id.patch; \
+ $(PATCH)/libdvbsi++-fix_ac3_descriptor.patch; \
+ $(PATCH)/libdvbsi++-fix-descriptorLenghth.patch; \
$(CONFIGURE) CPPFLAGS=$(DVBSI_CPPFLAG) \
--prefix=$(TARGETPREFIX) \
--build=$(BUILD) \