CFolderOutStream::FlushCorrupted() contains a straight forward loop:
for (;;)
{
UInt64 remain = GetRemain();
if (remain == 0)
return S_OK;
UInt32 size = (remain < kBufSize ? (UInt32)remain : (UInt32)kBufSize);
UInt32 processedSizeLocal = 0;
RINOK(Write2(buf, size, &processedSizeLocal, false));
}
GetRemain() returns m_FolderSize - m_PosInFolder. Write2() usually increments m_PosInFolder by the number of bytes written.
If m_FileIsOpen is false and m_CurrentIndex is equal to m_ExtractStatuses->Size() then Write2() returns S_OK without updating m_PosInFolder, so the above loop loops forever.
fixed code:
CabHandler.cpp: