Skip to content

Commit

Permalink
fixed segfaults due to missing tmpblanks
Browse files Browse the repository at this point in the history
  • Loading branch information
khannatanmai committed Jun 26, 2020
1 parent 2d11899 commit 73f6f5c
Showing 1 changed file with 36 additions and 12 deletions.
48 changes: 36 additions & 12 deletions apertium/transfer.cc
Expand Up @@ -2527,7 +2527,14 @@ Transfer::applyRule()
}
else
{
blank[i-1] = new string(UtfConverter::toUtf8(*tmpblank[i-1]));
if(tmpblank.size() < i-1)
{
blank[i-1] = new string(UtfConverter::toUtf8(*tmpblank[i-1]));
}
else
{
blank[i-1] = new string(UtfConverter::toUtf8(L""));
}
}

pair<wstring, int> tr;
Expand Down Expand Up @@ -2573,28 +2580,45 @@ Transfer::applyRule()
}
continue;
}
else if(*it == L'[' && *(it+1) == L'[')
else if(*it == L'[')
{
while(true)
if(*(it+1) == L'[') //wordbound blank
{
if(*it == L'\\')
while(true)
{
wblank.push_back(*it);
if(*it == L'\\')
{
wblank.push_back(*it);
it++;
wblank.push_back(*it);
}
else if(*it == L'^' && *(it-1) == L']' && *(it-2) == L']')
{
break;
}
else
{
wblank.push_back(*it);
}

it++;
wblank.push_back(*it);
}
else if(*it == L'^' && *(it-1) == L']' && *(it-2) == L']')
}
else
{
if(seenSlash == 0)
{
sl.push_back(*it);
}
else if(seenSlash == 1)
{
break;
tl.push_back(*it);
}
else
{
wblank.push_back(*it);
ref.push_back(*it);
}

it++;
}

continue;
}

Expand Down

0 comments on commit 73f6f5c

Please sign in to comment.