diff options
author | Nat Goodspeed <nat@lindenlab.com> | 2023-10-17 06:33:05 -0400 |
---|---|---|
committer | Nat Goodspeed <nat@lindenlab.com> | 2023-10-17 06:33:05 -0400 |
commit | 117f07e5a4b7882a44681c730dcc0628238cfec6 (patch) | |
tree | 5cf60970252ad671fdd352062ae41950f318a82b /indra/newview/llcurrencyuimanager.cpp | |
parent | 19f453fc2007f780ae5d819090db206f07d0a9c6 (diff) |
SL-18837: Avoid stuffing build number into 32-bit int.
Even though LLVersionInfo::getBuild() already returns a 64-bit int, various
consumers assumed it could fit into 32 bits. It was especially bad to pass it
to a classic C style varargs function. Only on a little-endian CPU, and only
because it was the last argument, the damage was limited to truncation --
instead of arbitrary undefined behavior.
Where the consumer doesn't support 64-bit ints, pass as string instead.
Diffstat (limited to 'indra/newview/llcurrencyuimanager.cpp')
-rw-r--r-- | indra/newview/llcurrencyuimanager.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/indra/newview/llcurrencyuimanager.cpp b/indra/newview/llcurrencyuimanager.cpp index 232e461fd0..4c0a5cf183 100644 --- a/indra/newview/llcurrencyuimanager.cpp +++ b/indra/newview/llcurrencyuimanager.cpp @@ -45,6 +45,7 @@ #include "llxmlrpctransaction.h" #include "llviewernetwork.h" #include "llpanel.h" +#include "stringize.h" const F64 CURRENCY_ESTIMATE_FREQUENCY = 2.0; @@ -158,7 +159,7 @@ void LLCurrencyUIManager::Impl::updateCurrencyInfo() mLocalCurrencyEstimated = true; return; } - + LLXMLRPCValue keywordArgs = LLXMLRPCValue::createStruct(); keywordArgs.appendString("agentId", gAgent.getID().asString()); keywordArgs.appendString( @@ -170,8 +171,10 @@ void LLCurrencyUIManager::Impl::updateCurrencyInfo() keywordArgs.appendInt("viewerMajorVersion", LLVersionInfo::instance().getMajor()); keywordArgs.appendInt("viewerMinorVersion", LLVersionInfo::instance().getMinor()); keywordArgs.appendInt("viewerPatchVersion", LLVersionInfo::instance().getPatch()); - keywordArgs.appendInt("viewerBuildVersion", LLVersionInfo::instance().getBuild()); - + // With GitHub builds, the build number is too big to fit in a 32-bit int, + // and XMLRPC_VALUE doesn't deal with integers wider than int. Use string. + keywordArgs.appendString("viewerBuildVersion", stringize(LLVersionInfo::instance().getBuild())); + LLXMLRPCValue params = LLXMLRPCValue::createArray(); params.append(keywordArgs); @@ -245,7 +248,9 @@ void LLCurrencyUIManager::Impl::startCurrencyBuy(const std::string& password) keywordArgs.appendInt("viewerMajorVersion", LLVersionInfo::instance().getMajor()); keywordArgs.appendInt("viewerMinorVersion", LLVersionInfo::instance().getMinor()); keywordArgs.appendInt("viewerPatchVersion", LLVersionInfo::instance().getPatch()); - keywordArgs.appendInt("viewerBuildVersion", LLVersionInfo::instance().getBuild()); + // With GitHub builds, the build number is too big to fit in a 32-bit int, + // and XMLRPC_VALUE doesn't deal with integers wider than int. Use string. + keywordArgs.appendString("viewerBuildVersion", stringize(LLVersionInfo::instance().getBuild())); LLXMLRPCValue params = LLXMLRPCValue::createArray(); params.append(keywordArgs); |