[PATCH] BAT decoding procedure fix
Roberto Corno <[email protected]>
| Newsgroups | gmane.comp.video.videolan.libdvbpsi.devel |
|---|---|
| Message-ID | <CAO6YRm-dY4KZ4L890y6pYUrEYn3iPbrqMn-u4QXeVemsRucJ5w@mail.gmail.com> |
dvbpsi_bat_sections_decode method parsing index was wrongly incremented dvbpsi_AddSectionBAT method did not correctly check for memory allocation patch is attached Regards, Roberto _______________________________________________ libdvbpsi-devel mailing list [email protected] http://mailman.videolan.org/listinfo/libdvbpsi-devel
0004-BAT-decoding-fix.patch
(application/octet-stream, 1.5 KB)
From 22a2efaeed9c0131fce3e8125cc46890f68cdfdd Mon Sep 17 00:00:00 2001 From: Roberto Corno <[email protected]> Date: Thu, 2 Aug 2012 17:10:31 +0200 Subject: [PATCH 4/4] BAT decoding fix --- src/tables/bat.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/tables/bat.c b/src/tables/bat.c index a3e2806..07dc9b9 100644 --- a/src/tables/bat.c +++ b/src/tables/bat.c @@ -339,7 +339,7 @@ static bool dvbpsi_AddSectionBAT(dvbpsi_t *p_dvbpsi, dvbpsi_bat_decoder_t *p_bat { p_bat_decoder->p_building_bat = dvbpsi_bat_new(p_section->i_extension, p_section->i_version, p_section->b_current_next); - if (p_bat_decoder->p_building_bat) + if (!p_bat_decoder->p_building_bat) return false; p_bat_decoder->i_last_section_number = p_section->i_last_number; @@ -486,17 +486,18 @@ void dvbpsi_bat_sections_decode(dvbpsi_bat_t* p_bat, p_byte += 2 + i_length; } p_end = p_byte + ( ((uint16_t)(p_byte[0] & 0x0f) << 8) | p_byte[1]); if(p_end > p_section->p_payload_end) { p_end = p_section->p_payload_end; } - p_byte += 2; /* - TSs */ for(; p_byte + 6 <= p_end;) { + p_byte += 2; uint16_t i_ts_id = ((uint16_t)p_byte[0] << 8) | p_byte[1]; uint16_t i_orig_network_id = ((uint16_t)p_byte[2] << 8) | p_byte[3]; uint16_t i_transport_descriptors_length = ((uint16_t)(p_byte[4] & 0x0f) << 8) | p_byte[5]; -- 1.7.5.4