From: Andreas Monzner Date: Tue, 7 Nov 2006 20:29:18 +0000 (+0000) Subject: fix crashes in cable scan X-Git-Tag: 2.6.0~2751 X-Git-Url: https://git.cweiske.de/enigma2.git/commitdiff_plain/8c0683ea5313544bf03af234c0a863f0b1045514 fix crashes in cable scan --- diff --git a/lib/dvb/esection.h b/lib/dvb/esection.h index 6c1683fe..6845bfa3 100644 --- a/lib/dvb/esection.h +++ b/lib/dvb/esection.h @@ -40,10 +40,17 @@ private: protected: int createTable(int nr, const __u8 *data, unsigned int max) { + int ssize = sections.size(); + if (max < ssize || nr >= max) + { + eDebug("kaputt max(%d) < ssize(%d) || nr(%d) >= max(%d)", + max, ssize, nr, max); + return 0; + } if (avail.find(nr) != avail.end()) delete sections[nr]; + sections.resize(max); - sections[nr] = new Section(data); avail.insert(nr); @@ -53,11 +60,11 @@ protected: else printf("-"); - printf(" %d/%d TID %02x\n", avail.size(), max, data[0]); + eDebug(" %d/%d TID %02x", avail.size(), max, data[0]); if (avail.size() == max) { - printf("done!\n"); + eDebug("done!"); return 1; } else return 0; @@ -69,8 +76,8 @@ public: } ~eTable() { - for (typename std::vector::iterator i(sections.begin()); i != sections.end(); ++i) - delete *i; + for (std::set::iterator i(avail.begin()); i != avail.end(); ++i) + delete sections[*i]; } }; diff --git a/lib/dvb/scan.cpp b/lib/dvb/scan.cpp index 70c3e6b3..8b895dc9 100644 --- a/lib/dvb/scan.cpp +++ b/lib/dvb/scan.cpp @@ -305,6 +305,12 @@ void eDVBScan::addChannelToScan(const eDVBChannelID &chid, iDVBFrontendParameter ++i; } + if (found_count > 0) + { + eDebug("already in todo list"); + return; + } + /* ... in the list of successfully scanned channels */ for (std::list >::const_iterator i(m_ch_scanned.begin()); i != m_ch_scanned.end(); ++i) if (sameChannel(*i, feparm))