From cb6db90c06472d52c4b45dee5a85aa581e4ee342 Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Thu, 25 Feb 2010 10:46:33 +0000 Subject: [PATCH] Fix crash, if channel has more than 4 CA descriptors, regarding #252 git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@412 e54a6e83-5905-42d5-8d5c-058d10e6a962 Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/55ef09a6ad3983f99acf686c5d42885821cf9170 Author: [CST] Focus Date: 2010-02-25 (Thu, 25 Feb 2010) ------------------ This commit was generated by Migit --- src/zapit/src/pmt.cpp | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/src/zapit/src/pmt.cpp b/src/zapit/src/pmt.cpp index a92ab4e9d..713fd43bd 100644 --- a/src/zapit/src/pmt.cpp +++ b/src/zapit/src/pmt.cpp @@ -429,27 +429,38 @@ int parse_pmt(CZapitChannel * const channel) if ( ia < pmtlen - 4 ) if(buffer[ia]==0x09 && buffer[ia+1]>0) { switch(buffer[ia+2]) { - case 0x06: pmt_caids[ci0++][0] = (buffer[ia+2] & 0x1f) << 8 | buffer[ia+3]; + case 0x06: pmt_caids[ci0][0] = (buffer[ia+2] & 0x1f) << 8 | buffer[ia+3]; + if(ci0 < 3) ci0++; break; - case 0x17: pmt_caids[ci1++][1] = (buffer[ia+2] & 0x1f) << 8 | buffer[ia+3]; + case 0x17: pmt_caids[ci1][1] = (buffer[ia+2] & 0x1f) << 8 | buffer[ia+3]; + if(ci1 < 3) ci1++; break; - case 0x01: pmt_caids[ci2++][2] = (buffer[ia+2] & 0x1f) << 8 | buffer[ia+3]; + case 0x01: pmt_caids[ci2][2] = (buffer[ia+2] & 0x1f) << 8 | buffer[ia+3]; + if(ci2 < 3) ci2++; break; - case 0x05: pmt_caids[ci3++][3] = (buffer[ia+2] & 0x1f) << 8 | buffer[ia+3]; + case 0x05: pmt_caids[ci3][3] = (buffer[ia+2] & 0x1f) << 8 | buffer[ia+3]; + if(ci3 < 3) ci3++; break; - case 0x18: pmt_caids[ci4++][4] = (buffer[ia+2] & 0x1f) << 8 | buffer[ia+3]; + case 0x18: pmt_caids[ci4][4] = (buffer[ia+2] & 0x1f) << 8 | buffer[ia+3]; + if(ci4 < 3) ci4++; break; - case 0x0B: pmt_caids[ci5++][5] = (buffer[ia+2] & 0x1f) << 8 | buffer[ia+3]; + case 0x0B: pmt_caids[ci5][5] = (buffer[ia+2] & 0x1f) << 8 | buffer[ia+3]; + if(ci5 < 3) ci5++; break; - case 0x0D: pmt_caids[ci6++][6] = (buffer[ia+2] & 0x1f) << 8 | buffer[ia+3]; + case 0x0D: pmt_caids[ci6][6] = (buffer[ia+2] & 0x1f) << 8 | buffer[ia+3]; + if(ci6 < 3) ci6++; break; - case 0x09: pmt_caids[ci7++][7] = (buffer[ia+2] & 0x1f) << 8 | buffer[ia+3]; + case 0x09: pmt_caids[ci7][7] = (buffer[ia+2] & 0x1f) << 8 | buffer[ia+3]; + if(ci7 < 3) ci7++; break; - case 0x26: pmt_caids[ci8++][8] = (buffer[ia+2] & 0x1f) << 8 | buffer[ia+3]; + case 0x26: pmt_caids[ci8][8] = (buffer[ia+2] & 0x1f) << 8 | buffer[ia+3]; + if(ci8 < 3) ci8++; break; - case 0x4a: pmt_caids[ci9++][9] = (buffer[ia+2] & 0x1f) << 8 | buffer[ia+3]; + case 0x4a: pmt_caids[ci9][9] = (buffer[ia+2] & 0x1f) << 8 | buffer[ia+3]; + if(ci9 < 3) ci9++; break; - case 0x0E: pmt_caids[ci10++][10] = (buffer[ia+2] & 0x1f) << 8 | buffer[ia+3]; + case 0x0E: pmt_caids[ci10][10] = (buffer[ia+2] & 0x1f) << 8 | buffer[ia+3]; + if(ci10 < 3) ci10++; break; } //switch } // if