From fae778e45b79b03cc02e4b253295875ebc73bfa4 Mon Sep 17 00:00:00 2001 From: Niels Martin Hansen Date: Tue, 10 Jul 2007 21:31:06 +0000 Subject: [PATCH] Require [Script Info] line as first thing in SSA/ASS files. (Probably. This might make VSFilter fail on invalid scripts, oh no!) Originally committed to SVN as r1406. --- vsfilter/subtitles/STS.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/vsfilter/subtitles/STS.cpp b/vsfilter/subtitles/STS.cpp index af8c1d4c7..9840e01c6 100644 --- a/vsfilter/subtitles/STS.cpp +++ b/vsfilter/subtitles/STS.cpp @@ -1303,6 +1303,7 @@ static bool LoadUUEFont(CTextFile* file) static bool OpenSubStationAlpha(CTextFile* file, CSimpleTextSubtitle& ret, int CharSet) { bool fRet = false; + bool firstLine = true; int version = 3, sver = 3; @@ -1323,6 +1324,8 @@ static bool OpenSubStationAlpha(CTextFile* file, CSimpleTextSubtitle& ret, int C if(entry == L"[script info]") { + // [script info] must be the first line + if (!firstLine) return false; fRet = true; } else if(entry == L"playresx") @@ -1499,6 +1502,8 @@ if(version >= 6)marginRect.bottom = GetInt(buff); { LoadUUEFont(file); } + + firstLine = false; } return(fRet);