Index: libs/libmythtv/mpeg/mpegstreamdata.cpp
===================================================================
--- libs/libmythtv/mpeg/mpegstreamdata.cpp	(revision 12202)
+++ libs/libmythtv/mpeg/mpegstreamdata.cpp	(working copy)
@@ -692,7 +692,9 @@
         DONE_WITH_PES_PACKET(); // already parsed this table, toss it.
     }
 
-    HandleTables(tspacket->PID(), *psip);
+    if (psip->VerifyPSIP(!_have_CRC_bug))
+        HandleTables(tspacket->PID(), *psip);
+
     DONE_WITH_PES_PACKET();
 }
 #undef DONE_WITH_PES_PACKET
Index: libs/libmythtv/mpeg/mpegtables.h
===================================================================
--- libs/libmythtv/mpeg/mpegtables.h	(revision 12202)
+++ libs/libmythtv/mpeg/mpegtables.h	(working copy)
@@ -359,6 +359,8 @@
     // only for real ATSC PSIP tables, not similar MPEG2 tables
     void SetProtocolVersion(int ver) { pesdata()[8] = ver; }
 
+    const bool VerifyPSIP(bool verify_crc) const;
+
     const QString toString(void) const;
 
     static const uint PSIP_OFFSET = 8; // general PSIP header offset
Index: libs/libmythtv/mpeg/mpegtables.cpp
===================================================================
--- libs/libmythtv/mpeg/mpegtables.cpp	(revision 12202)
+++ libs/libmythtv/mpeg/mpegtables.cpp	(working copy)
@@ -66,6 +66,54 @@
     return stream_id;
 }
 
+const bool PSIPTable::VerifyPSIP(bool verify_crc) const
+{
+    if (verify_crc && (CalcCRC() != CRC()))
+    {
+        VERBOSE(VB_SIPARSER,
+                QString("PSIPTable: Failed CRC check 0x%1 != 0x%2 "
+                        "for StreamID = 0x%3")
+                .arg(CRC(),0,16).arg(CalcCRC(),0,16).arg(StreamID(),0,16));
+        return false;
+    }
+
+    unsigned char *bufend = _fullbuffer + _allocSize;
+
+    if ((_pesdata + 2) >= bufend)
+        return false; // can't query length
+
+    if (psipdata() >= bufend)
+        return false; // data outside buffer
+
+    if (TableID::PAT == TableID())
+    {
+        uint pcnt = (SectionLength() - PSIP_OFFSET - 2) >> 2;
+        return (psipdata() + (pcnt << 2) + 3 < bufend);
+    }
+
+    if (TableID::PMT == TableID())
+    {
+        if (psipdata() + 3 >= bufend)
+            return false; // can't query program info length
+
+        ProgramMapTable pmt(*this);
+        if ((pmt.ProgramInfo() > bufend) ||
+            (pmt.ProgramInfo() + pmt.ProgramInfoLength() > bufend))
+        {
+            return false;
+        }
+
+        for (uint i = 0; i < pmt.StreamCount(); i++)
+        {
+            if ((pmt.StreamInfo(i) > bufend) ||
+                (pmt.StreamInfo(i) + pmt.StreamInfoLength(i) > bufend))
+            {
+                return false;
+            }
+        }
+    }
+}
+
 ProgramAssociationTable* ProgramAssociationTable::CreateBlank(bool small)
 {
     (void) small; // currently always a small packet..
Index: libs/libmythtv/mpeg/pespacket.h
===================================================================
--- libs/libmythtv/mpeg/pespacket.h	(revision 12202)
+++ libs/libmythtv/mpeg/pespacket.h	(working copy)
@@ -249,7 +249,7 @@
 
     unsigned char *_pesdata;    ///< Pointer to PES data in full buffer
     unsigned char *_fullbuffer; ///< Pointer to allocated data
-  private:
+
     uint _psiOffset;    ///< AFCOffset + StartOfFieldPointer
     uint _ccLast;       ///< Continuity counter of last inserted TS Packet
     uint _pesdataSize;  ///< Number of data bytes (TS header + PES data)
