Skip to content

Commit 0bb61ad

Browse files
committed
SL-19807 BugSplat Crash: LLDispatchSetEstateExperience::getIDs()
1 parent 0d411e2 commit 0bb61ad

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

indra/newview/llfloaterregioninfo.cpp

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ class LLDispatchSetEstateExperience : public LLDispatchHandler
144144
const LLUUID& invoice,
145145
const sparam_t& strings);
146146

147-
LLSD getIDs( sparam_t::const_iterator it, sparam_t::const_iterator end, S32 count );
147+
static LLSD getIDs( sparam_t::const_iterator it, sparam_t::const_iterator end, S32 count );
148148
};
149149

150150

@@ -2450,11 +2450,12 @@ bool LLDispatchSetEstateAccess::operator()(
24502450
return true;
24512451
}
24522452

2453+
// static
24532454
LLSD LLDispatchSetEstateExperience::getIDs( sparam_t::const_iterator it, sparam_t::const_iterator end, S32 count )
24542455
{
24552456
LLSD idList = LLSD::emptyArray();
24562457
LLUUID id;
2457-
while(count--> 0)
2458+
while (count-- > 0 && it < end)
24582459
{
24592460
memcpy(id.mData, (*(it++)).data(), UUID_BYTES);
24602461
idList.append(id);
@@ -2468,7 +2469,7 @@ LLSD LLDispatchSetEstateExperience::getIDs( sparam_t::const_iterator it, sparam_
24682469
// strings[2] = str(num blocked)
24692470
// strings[3] = str(num trusted)
24702471
// strings[4] = str(num allowed)
2471-
// strings[8] = bin(uuid) ...
2472+
// strings[5] = bin(uuid) ...
24722473
// ...
24732474
bool LLDispatchSetEstateExperience::operator()(
24742475
const LLDispatcher* dispatcher,
@@ -2477,23 +2478,30 @@ bool LLDispatchSetEstateExperience::operator()(
24772478
const sparam_t& strings)
24782479
{
24792480
LLPanelRegionExperiences* panel = LLFloaterRegionInfo::getPanelExperiences();
2480-
if (!panel) return true;
2481+
if (!panel)
2482+
return true;
2483+
2484+
const sparam_t::size_type MIN_SIZE = 5;
2485+
if (strings.size() < MIN_SIZE)
2486+
return true;
24812487

2488+
// Skip 2 parameters
24822489
sparam_t::const_iterator it = strings.begin();
24832490
++it; // U32 estate_id = strtol((*it).c_str(), NULL, 10);
24842491
++it; // U32 send_to_agent_only = strtoul((*(++it)).c_str(), NULL, 10);
24852492

2493+
// Read 3 parameters
24862494
LLUUID id;
24872495
S32 num_blocked = strtol((*(it++)).c_str(), NULL, 10);
24882496
S32 num_trusted = strtol((*(it++)).c_str(), NULL, 10);
24892497
S32 num_allowed = strtol((*(it++)).c_str(), NULL, 10);
24902498

24912499
LLSD ids = LLSD::emptyMap()
2492-
.with("blocked", getIDs(it, strings.end(), num_blocked))
2493-
.with("trusted", getIDs(it + (num_blocked), strings.end(), num_trusted))
2494-
.with("allowed", getIDs(it + (num_blocked+num_trusted), strings.end(), num_allowed));
2500+
.with("blocked", getIDs(it, strings.end(), num_blocked))
2501+
.with("trusted", getIDs(it + num_blocked, strings.end(), num_trusted))
2502+
.with("allowed", getIDs(it + num_blocked + num_trusted, strings.end(), num_allowed));
24952503

2496-
panel->processResponse(ids);
2504+
panel->processResponse(ids);
24972505

24982506
return true;
24992507
}

0 commit comments

Comments
 (0)