More teletext reading validation - thx yellobyte :)

Work on #8186
This commit is contained in:
niksedk 2024-04-16 13:09:27 +02:00
parent 4f6ac7ee4b
commit 0139ec0a75

View File

@ -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);
}