This removes an assert on the PAT table length in
ProgramAssociationTable:Create(). Instead it simply fails to create a new PAT table from an old PAT table if the old PAT table exceeds the maximum length. I've also modified mpegstreamdata.cpp so that it will not segfault if ProgramAssociationTable:Create() fails to create a
new PAT table.


This should of course never be triggered, but assuming my last assert removal patch is applied, this removes the last assert on data in the libs/libmythtv/mpeg directory. The remaining asserts can only be triggered by programmer error. These asserts might help us when we integrate the ATSC and DVB code.

-- Daniel
Index: libs/libmythtv/mpeg/mpegtables.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/mpeg/mpegtables.cpp,v
retrieving revision 1.1
diff -u -r1.1 mpegtables.cpp
--- libs/libmythtv/mpeg/mpegtables.cpp  8 Dec 2004 02:04:08 -0000       1.1
+++ libs/libmythtv/mpeg/mpegtables.cpp  20 Jan 2005 04:58:20 -0000
@@ -32,7 +32,13 @@
     pat->SetLength(PSIP_OFFSET+(count*4));
 
     // create PAT data
-    assert((count*4)<(184-PSIP_OFFSET)); // PAT must be in single TS
+    if ((count*4)>=(184-PSIP_OFFSET))
+    { // old PAT must be in single TS for this create function
+        VERBOSE(VB_IMPORTANT, "PAT::Create: Error, old "
+                "PAT size exceeds maximum PAT size.");
+        return 0;
+    }
+
     uint offset = PSIP_OFFSET;
     for (uint i=0; i<count; i++)
     {
Index: libs/libmythtv/mpeg/mpegstreamdata.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/mpeg/mpegstreamdata.cpp,v
retrieving revision 1.2
diff -u -r1.2 mpegstreamdata.cpp
--- libs/libmythtv/mpeg/mpegstreamdata.cpp      24 Dec 2004 23:24:07 -0000      
1.2
+++ libs/libmythtv/mpeg/mpegstreamdata.cpp      20 Jan 2005 04:58:20 -0000
@@ -114,6 +114,14 @@
     uint ver = pat.Version();
     ProgramAssociationTable* pat2 =
         ProgramAssociationTable::Create(tsid, ver, pnums, pids);
+
+    if (!pat2)
+    {
+        VERBOSE(VB_IMPORTANT, "MPEGStreamData::CreatePAT: "
+                "Failed to create Program Association Table.");
+        return false;
+    }
+
     
pat2->tsheader()->SetContinuityCounter(pat.tsheader()->ContinuityCounter());
 
     VERBOSE(VB_RECORD, QString("pmt_pid(0x%1)").arg(_pid_pmt, 0, 16));
_______________________________________________
mythtv-dev mailing list
[email protected]
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev

Reply via email to