From 0139ec0a75d14564f3970b9727f706a2f875e4d2 Mon Sep 17 00:00:00 2001 From: niksedk Date: Tue, 16 Apr 2024 13:09:27 +0200 Subject: [PATCH] More teletext reading validation - thx yellobyte :) Work on #8186 --- src/libse/ContainerFormats/TransportStream/DvbSubPes.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libse/ContainerFormats/TransportStream/DvbSubPes.cs b/src/libse/ContainerFormats/TransportStream/DvbSubPes.cs index fb928d896..d63607c8a 100644 --- a/src/libse/ContainerFormats/TransportStream/DvbSubPes.cs +++ b/src/libse/ContainerFormats/TransportStream/DvbSubPes.cs @@ -174,7 +174,7 @@ namespace Nikse.SubtitleEdit.Core.ContainerFormats.TransportStream var dataUnitLen = _dataBuffer[i++]; if (dataUnitId == (int)Teletext.DataUnitT.DataUnitEbuTeletextNonSubtitle || dataUnitId == (int)Teletext.DataUnitT.DataUnitEbuTeletextSubtitle) { - if (dataUnitLen == 44) // teletext payload has always size 44 bytes + if (dataUnitLen == 44 && _dataBuffer.Length > i + 43) // teletext payload has always size 44 bytes { Teletext.ProcessTelxPacket((Teletext.DataUnitT)dataUnitId, new Teletext.TeletextPacketPayload(_dataBuffer, i), timestamp, teletextRunSettings, pageNumberBcd, pageNumber); }