#989 Infinite loop in CompatGetCheckout

open
WinCvs (709)
5
2008-08-22
2008-08-22
John M. Drescher
No

On my development system I have had a case where I could get wincvs to hang on my repository. The following code is causing the problem and I was able to fix it:

CheckoutDlg.cpp line 678

if( !path.empty() )
{
while( IsCvsDirectory(path.c_str()) )
{
string uppath, folder;
if( !SplitPath(path.c_str(), uppath, folder) || uppath.empty() )
{
break;
}

path = uppath;
}
}

The problem is split path for X:\ returns an uppath of x:\ and a folder of "" causing this loop to never end.

The fix is:
if( !path.empty() )
{
while( IsCvsDirectory(path.c_str()) )
{
string uppath, folder;
if( !SplitPath(path.c_str(), uppath, folder) || uppath.empty() || folder.empty() )
{
break;
}

path = uppath;
}
}

Discussion