[mythtv] regression with 7f00642b

Gary Buhrmaster gary.buhrmaster at gmail.com
Fri May 11 06:11:32 UTC 2018


On Thu, May 10, 2018 at 7:14 PM, David Hampton <mythtv at love2code.net> wrote:

> I have reverted this patch.  I don't have the resources to recreate the
> original crash, nor the crash that was caused by Gary's patch.  I'd be
> happy to commit a fix that anyone comes up with, but I'm afraid I can't
> help in the creation of said fix.  Sorry.

Attempt 2.

This proposed patch is fundamentally ugly, but since passing
in a NULL value to memcpy is undefined (my first thought
was check for empty, and pass in a NULL for the pointer
in the case the size is zero, but a memcpy from NULL,
even with a zero length of the copy, is undefined by standards,
that is not acceptable), this seems like an approach that will
work for the moment and cause the side effects of the rest
of calling the functions to continue working.

It works for my test case.  I would like to hear from some
dvb-s/s2 users.




diff --git a/mythtv/libs/libmythtv/mpeg/mpegtables.cpp
b/mythtv/libs/libmythtv/mpeg/mpegtables.cpp
index 3120b821f6..dbe87d5899 100644
--- a/mythtv/libs/libmythtv/mpeg/mpegtables.cpp
+++ b/mythtv/libs/libmythtv/mpeg/mpegtables.cpp
@@ -445,7 +445,12 @@ ProgramMapTable* ProgramMapTable::Create(
         uint len = global_desc[i][1] + 2;
         gdesc.insert(gdesc.end(), global_desc[i], global_desc[i] + len);
     }
-    pmt->SetProgramInfo(&gdesc[0], gdesc.size());
+
+    // TODO: Fix this properly?
+    if (gdesc.empty())
+        pmt->SetProgramInfo((unsigned char *)"", 0);
+    else
+        pmt->SetProgramInfo(&gdesc[0], gdesc.size());

     for (uint i = 0; i < count; i++)
     {
@@ -457,7 +462,11 @@ ProgramMapTable* ProgramMapTable::Create(
                          prog_desc[i][j], prog_desc[i][j] + len);
         }

-        pmt->AppendStream(pids[i], types[i], &pdesc[0], pdesc.size());
+        // TODO: Fix this properly?
+        if (pdesc.empty())
+            pmt->AppendStream(pids[i], types[i], (unsigned char *)"", 0);
+        else
+            pmt->AppendStream(pids[i], types[i], &pdesc[0], pdesc.size());
     }
     pmt->Finalize();


More information about the mythtv-dev mailing list