Skip to content

Commit

Permalink
fix possible crashes of invaild drawing
Browse files Browse the repository at this point in the history
  • Loading branch information
Masaiki committed Feb 26, 2021
1 parent 49c31e5 commit ac3a72b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/subtitles/RTS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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))
Expand All @@ -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);
Expand Down

0 comments on commit ac3a72b

Please sign in to comment.