You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Version 0.11.1 introduced an issue in ofXml, that leads to random undefined behaviour.
std::locale returns a temporary char*, this is saved in auto loc, but the next line ( std::setlocale( LC_NUMERIC, "C" );) invalidates this internal char*, so it should not be used anymore from then on.
But in the line 252 it is used again to reset the locale. This leads to random behaviour down the line as the loc pointer is not valid anymore at that point.
248floatofXml::getFloatValue() const{
249auto loc = std::setlocale( LC_NUMERIC, NULL );
250std::setlocale( LC_NUMERIC, "C" );
251float f = this->xml.text().as_float();
252std::setlocale( LC_NUMERIC, loc );
253return f;
254 }
So this should be changed by saving a deep copy to the char*, maybe like this:
Version 0.11.1 introduced an issue in ofXml, that leads to random undefined behaviour.
std::locale returns a temporary
char*
, this is saved inauto loc
, but the next line (std::setlocale( LC_NUMERIC, "C" );
) invalidates this internalchar*
, so it should not be used anymore from then on.But in the line 252 it is used again to reset the locale. This leads to random behaviour down the line as the
loc
pointer is not valid anymore at that point.So this should be changed by saving a deep copy to the
char*
, maybe like this:The same change is need in
ofXml::Attribute::getFloatValue
,ofXml::Attribute::getFloatValue
andofXml::Attribute::getFloatValue
as well.This issue was introduced in 6678 that tried to fix 6111
The text was updated successfully, but these errors were encountered: