diff --git a/indra/newview/llfloateravatarlist.cpp b/indra/newview/llfloateravatarlist.cpp index 3de561214..1a9636a44 100644 --- a/indra/newview/llfloateravatarlist.cpp +++ b/indra/newview/llfloateravatarlist.cpp @@ -172,7 +172,8 @@ void LLAvatarListEntry::processProperties(void* data, EAvatarProcessorType type) { using namespace boost::gregorian; int year, month, day; - if (sscanf(pAvatarData->born_on.c_str(),"%d/%d/%d",&month,&day,&year) == 3) + const auto born = pAvatarData->born_on; + if (!born.empty() && sscanf(born.c_str(),"%d/%d/%d",&month,&day,&year) == 3) try { mAge = (day_clock::local_day() - date(year, month, day)).days(); @@ -187,7 +188,7 @@ void LLAvatarListEntry::processProperties(void* data, EAvatarProcessorType type) } else // Something failed, resend request { - LL_WARNS() << "Failed to extract age from APT_PROPERTIES for " << mID << ", received \"" << pAvatarData->born_on << "\". Requesting properties again." << LL_ENDL; + LL_WARNS() << "Failed to extract age from APT_PROPERTIES for " << mID << ", received \"" << born << "\". Requesting properties again." << LL_ENDL; inst.sendAvatarPropertiesRequest(mID); } } diff --git a/indra/newview/llpanelavatar.cpp b/indra/newview/llpanelavatar.cpp index 5871d47bd..ca3d9f52f 100644 --- a/indra/newview/llpanelavatar.cpp +++ b/indra/newview/llpanelavatar.cpp @@ -194,11 +194,16 @@ void LLPanelAvatarSecondLife::processProperties(void* data, EAvatarProcessorType { using namespace boost::gregorian; int year, month, day; - sscanf(pAvatarData->born_on.c_str(),"%d/%d/%d", &month, &day, &year); - date birthday(year, month, day), today(day_clock::local_day()); - std::ostringstream born_on; - born_on << pAvatarData->born_on << " (" << today - birthday << ')'; - childSetValue("born", born_on.str()); + const auto& born = pAvatarData->born_on; + if (!born.empty() && sscanf(born.c_str(),"%d/%d/%d", &month, &day, &year) == 3 // Make sure input is valid + && month > 0 && month <= 12 && day > 0 && day <= 31 && year >= 1400) // Don't use numbers that gregorian will choke on + { + date birthday(year, month, day), today(day_clock::local_day()); + std::ostringstream born_on; + born_on << pAvatarData->born_on << " (" << today - birthday << ')'; + childSetValue("born", born_on.str()); + } + else childSetValue("born", born); } bool allow_publish = (pAvatarData->flags & AVATAR_ALLOW_PUBLISH);