diff --git a/skyscraper8/Mpeg2/PsiDecoder.cs b/skyscraper8/Mpeg2/PsiDecoder.cs index 55760cd..64762c8 100644 --- a/skyscraper8/Mpeg2/PsiDecoder.cs +++ b/skyscraper8/Mpeg2/PsiDecoder.cs @@ -28,10 +28,7 @@ namespace skyscraper5.Mpeg2 { Span span = packet.GetPayload(); int automataIterations = 0; - - if (packet.PID == 0x0881) - ; - + while(span.Length > 0) { switch(state) @@ -45,6 +42,12 @@ namespace skyscraper5.Mpeg2 } byte startOffset = span[0]; span = span.Slice(1); + if (startOffset > span.Length) + { + logger.WarnFormat("An MPEG-2 section with an invalid starting offsett was found. It will be skipped."); + state = 0; + return; + } span = span.Slice(startOffset); state = 1; break;