mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-25 20:52:44 +01:00
Fixed crash in TS parser - thx Verner :)
This commit is contained in:
parent
2af71513f3
commit
798b46c927
@ -37,7 +37,7 @@ namespace Nikse.SubtitleEdit.Core.TransportStream
|
|||||||
|
|
||||||
public DvbSubPes(byte[] buffer, int index)
|
public DvbSubPes(byte[] buffer, int index)
|
||||||
{
|
{
|
||||||
if (buffer.Length < 9)
|
if (buffer.Length < index + 9)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
StartCode = Helper.GetEndian(buffer, index + 0, 3);
|
StartCode = Helper.GetEndian(buffer, index + 0, 3);
|
||||||
@ -59,6 +59,9 @@ namespace Nikse.SubtitleEdit.Core.TransportStream
|
|||||||
|
|
||||||
HeaderDataLength = buffer[index + 8];
|
HeaderDataLength = buffer[index + 8];
|
||||||
|
|
||||||
|
if (buffer.Length < index + 9 + HeaderDataLength)
|
||||||
|
return;
|
||||||
|
|
||||||
if (StreamId == 0xBD) // 10111101 binary = 189 decimal = 0xBD hex -> private_stream_1
|
if (StreamId == 0xBD) // 10111101 binary = 189 decimal = 0xBD hex -> private_stream_1
|
||||||
{
|
{
|
||||||
int id = buffer[index + 9 + HeaderDataLength];
|
int id = buffer[index + 9 + HeaderDataLength];
|
||||||
|
@ -58,6 +58,12 @@ namespace Nikse.SubtitleEdit.Core.TransportStream
|
|||||||
int dataType = buffer[index + 7];
|
int dataType = buffer[index + 7];
|
||||||
int length = TopFieldDataBlockLength;
|
int length = TopFieldDataBlockLength;
|
||||||
|
|
||||||
|
if (length + index + 7 > buffer.Length) // check if buffer is large enough
|
||||||
|
{
|
||||||
|
Image = new Bitmap(1, 1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
index += 8;
|
index += 8;
|
||||||
int start = index;
|
int start = index;
|
||||||
int x = 0;
|
int x = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user