Archived

This forum has been archived. Please start a new discussion on GitHub.

A bug of ICE2.0.0 Source code, in Ice::PropertiesI::PropertiesI()

Here is the bug for Ice-2.0.0.

in /src/Ice/PropertiesI.cpp

Ice::PropertiesI::PropertiesI(StringSeq& args)
{
StringSeq::iterator q = args.begin();
if(q != args.end())
{
setProperty("Ice.ProgramName", *q);
}
while(q != args.end())
{
string s = *q;
if(s.find("--Ice.Config") == 0)
{
if(s.find('=') == string::npos)
{
s += "=1";
}
parseLine(s.substr(2));
args.erase(q); //BUG!!! this will result in 'while(q != args.end())' access to freed memory.
//This will result in error with STLport 4.5
}
else
{
++q;
}
}

loadConfig();

args = parseIceCommandLineOptions(args);
}

the new function is:
Ice::PropertiesI::PropertiesI(StringSeq& args)
{
//Modified by WXD20041205.
int have_found = 0;
StringSeq::iterator save_q;

StringSeq::iterator q = args.begin();
if(q != args.end())
{
setProperty("Ice.ProgramName", *q);
}
while(q != args.end())
{
string s = *q;
if(s.find("--Ice.Config") == 0)
{
if(s.find('=') == string::npos)
{
s += "=1";
}
parseLine(s.substr(2));

have_found = 1; //wxd modified.
save_q = q;

}
++q;
}
if(have_found){
args.erase(save_q);
}

loadConfig();

args = parseIceCommandLineOptions(args);
}

Comments