From ac3a72b9747b5f1746112ae1aee741210414aa34 Mon Sep 17 00:00:00 2001 From: VegeHime Date: Fri, 26 Feb 2021 10:46:10 +0800 Subject: [PATCH] fix possible crashes of invaild drawing --- src/subtitles/RTS.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/subtitles/RTS.cpp b/src/subtitles/RTS.cpp index d1d1972..87e20b4 100644 --- a/src/subtitles/RTS.cpp +++ b/src/subtitles/RTS.cpp @@ -750,6 +750,7 @@ bool CPolygon::ParseStr() } break; case 'l': + if (m_pathPointsOrg.GetCount() < 1) break; while(GetPOINT(s, p)) { m_pathTypesOrg.Add(PT_LINETO); @@ -758,6 +759,7 @@ bool CPolygon::ParseStr() break; case 'b': j = m_pathTypesOrg.GetCount(); + if (j < 1) break; while(GetPOINT(s, p)) { m_pathTypesOrg.Add(PT_BEZIERTO); @@ -769,6 +771,7 @@ bool CPolygon::ParseStr() m_pathPointsOrg.SetCount(j); break; case 's': + if (m_pathPointsOrg.GetCount() < 1) break; j = lastsplinestart = m_pathTypesOrg.GetCount(); i = 3; while(i-- && GetPOINT(s, p)) @@ -785,6 +788,7 @@ bool CPolygon::ParseStr() } // no break here case 'p': + if (m_pathPointsOrg.GetCount() < 3) break; while(GetPOINT(s, p)) { m_pathTypesOrg.Add(PT_BSPLINEPATCHTO);