This commit is contained in:
Liru Færs
2020-04-23 23:23:38 -04:00
9 changed files with 65 additions and 21 deletions

View File

@@ -1072,8 +1072,8 @@ S32 LLSDBinaryParser::doParse(std::istream& istr, LLSD& data) const
// the size, and read it.
U32 size_nbo = 0;
read(istr, (char*)&size_nbo, sizeof(U32)); /*Flawfinder: ignore*/
S32 size = (S32)ntohl(size_nbo);
if(mCheckLimits && (size > mMaxBytesLeft))
S32 size = (S32)ntohl(size_nbo); // Can return negative size if > 2^31.
if(size < 0 || mCheckLimits && (size > mMaxBytesLeft))
{
parse_count = PARSE_FAILURE;
}
@@ -1113,7 +1113,11 @@ S32 LLSDBinaryParser::parseMap(std::istream& istr, LLSD& map) const
map = LLSD::emptyMap();
U32 value_nbo = 0;
read(istr, (char*)&value_nbo, sizeof(U32)); /*Flawfinder: ignore*/
S32 size = (S32)ntohl(value_nbo);
S32 size = (S32)ntohl(value_nbo); // Can return negative size if > 2^31.
if (size < 0)
{
return PARSE_FAILURE;
}
S32 parse_count = 0;
S32 count = 0;
char c = get(istr);
@@ -1167,7 +1171,11 @@ S32 LLSDBinaryParser::parseArray(std::istream& istr, LLSD& array) const
array = LLSD::emptyArray();
U32 value_nbo = 0;
read(istr, (char*)&value_nbo, sizeof(U32)); /*Flawfinder: ignore*/
S32 size = (S32)ntohl(value_nbo);
S32 size = (S32)ntohl(value_nbo); // Can return negative size if > 2^31.
if (size < 0)
{
return PARSE_FAILURE;
}
// *FIX: This would be a good place to reserve some space in the
// array...
@@ -1208,8 +1216,8 @@ bool LLSDBinaryParser::parseString(
// *FIX: This is memory inefficient.
U32 value_nbo = 0;
read(istr, (char*)&value_nbo, sizeof(U32)); /*Flawfinder: ignore*/
S32 size = (S32)ntohl(value_nbo);
if(mCheckLimits && (size > mMaxBytesLeft)) return false;
S32 size = (S32)ntohl(value_nbo); // Can return negative size if > 2^31.
if(size < 0 || mCheckLimits && (size > mMaxBytesLeft)) return false;
std::vector<char> buf;
if(size)
{

View File

@@ -1197,6 +1197,10 @@ void LLVertexBuffer::genBuffer(U32 size)
{
mMappedData = sDynamicVBOPool.allocate(mGLBuffer, mSize);
}
if ((sDisableVBOMapping || mUsage != GL_DYNAMIC_DRAW_ARB) && !mMappedData)
{
LL_ERRS() << "mMappedData allocation failedd" << LL_ENDL;
}
sGLCount++;
}
@@ -1213,6 +1217,10 @@ void LLVertexBuffer::genIndices(U32 size)
{
mMappedIndexData = sDynamicIBOPool.allocate(mGLIndices, mIndicesSize);
}
if ((sDisableVBOMapping || mUsage != GL_DYNAMIC_DRAW_ARB) && !mMappedIndexData)
{
LL_ERRS() << "mMappedIndexData allocation failedd" << LL_ENDL;
}
sGLCount++;
}
@@ -1848,6 +1856,7 @@ volatile U8* LLVertexBuffer::mapIndexBuffer(S32 index, S32 count, bool map_range
LL_ERRS() << "Attempted to map a specific range of a buffer that was already mapped." << LL_ENDL;
}
bool was_locked = mIndexLocked;
if (!mIndexLocked)
{
mIndexLocked = true;
@@ -1942,6 +1951,10 @@ volatile U8* LLVertexBuffer::mapIndexBuffer(S32 index, S32 count, bool map_range
LL_ERRS() << "glMapBuffer returned NULL (no index data)" << LL_ENDL;
}
else if (was_locked)
{
LL_ERRS() << "mIndexLocked was true but no Index data allocated" << LL_ENDL;
}
else
{
LL_ERRS() << "memory allocation for Index data failed. " << LL_ENDL;

View File

@@ -531,17 +531,24 @@ void LLChatBar::sendChat( EChatType type )
// static
void LLChatBar::startChat(const char* line)
{
if (!gChatBar || !gChatBar->getParent())
{
return;
}
gChatBar->getParent()->setVisible(TRUE);
gChatBar->setKeyboardFocus(TRUE);
gSavedSettings.setBOOL("ChatVisible", TRUE);
if (line && gChatBar->mInputEditor)
if (gChatBar->mInputEditor)
{
std::string line_string(line);
gChatBar->mInputEditor->setText(line_string);
if (line)
{
std::string line_string(line);
gChatBar->mInputEditor->setText(line_string);
}
// always move cursor to end so users don't obliterate chat when accidentally hitting WASD
gChatBar->mInputEditor->setCursorToEnd();
}
// always move cursor to end so users don't obliterate chat when accidentally hitting WASD
gChatBar->mInputEditor->setCursorToEnd();
}
@@ -550,7 +557,8 @@ void LLChatBar::startChat(const char* line)
void LLChatBar::stopChat()
{
// In simple UI mode, we never release focus from the chat bar
gChatBar->setKeyboardFocus(FALSE);
if (gChatBar)
gChatBar->setKeyboardFocus(FALSE);
// If we typed a movement key and pressed return during the
// same frame, the keyboard handlers will see the key as having
@@ -562,7 +570,8 @@ void LLChatBar::stopChat()
gAgent.stopTyping();
// hide chat bar so it doesn't grab focus back
gChatBar->getParent()->setVisible(FALSE);
if (gChatBar && gChatBar->getParent())
gChatBar->getParent()->setVisible(FALSE);
gSavedSettings.setBOOL("ChatVisible", FALSE);
}

View File

@@ -515,6 +515,10 @@ void LLCloudLayer::connectNeighbor(LLCloudLayer *cloudp, U32 direction)
return;
}
if (mNeighbors[direction])
{
mNeighbors[direction]->mNeighbors[gDirOpposite[direction]] = NULL;
}
mNeighbors[direction] = cloudp;
if (cloudp)
mNeighbors[direction]->mNeighbors[gDirOpposite[direction]] = this;

View File

@@ -94,7 +94,7 @@ void LLHUDIcon::renderIcon(BOOL for_select)
if (mHidden)
return;
if (mSourceObject.isNull() || mImagep.isNull())
if (mSourceObject.isNull() || mImagep.isNull() || mSourceObject->mDrawable.isNull())
{
markDead();
return;

View File

@@ -1895,6 +1895,11 @@ void LLIMProcessing::requestOfflineMessages()
void LLIMProcessing::requestOfflineMessagesCoro(const LLCoroResponder& responder)
{
if (LLApp::isQuitting() || !gAgent.getRegion())
{
return;
}
auto status = responder.getStatus();
if (!responder.isGoodStatus(status)) // success = httpResults["success"].asBoolean();

View File

@@ -548,24 +548,29 @@ void start_chat( EKeystate s )
}
// start chat
gChatBar->startChat(NULL);
LLChatBar::startChat(NULL);
}
void start_gesture( EKeystate s )
{
if (LLAppViewer::instance()->quitRequested())
{
return; // can't talk, gotta go, kthxbye!
}
LLUICtrl* focus_ctrlp = dynamic_cast<LLUICtrl*>(gFocusMgr.getKeyboardFocus());
if (KEYSTATE_UP == s &&
! (focus_ctrlp && focus_ctrlp->acceptsTextInput()))
{
if (gChatBar->getCurrentChat().empty())
if (gChatBar && gChatBar->getCurrentChat().empty())
{
// No existing chat in chat editor, insert '/'
gChatBar->startChat("/");
LLChatBar::startChat("/");
}
else
{
// Don't overwrite existing text in chat editor
gChatBar->startChat(NULL);
LLChatBar::startChat(NULL);
}
}
}

View File

@@ -872,7 +872,7 @@ LLOcclusionCullingGroup::~LLOcclusionCullingGroup()
if (mSpatialPartition)
{
auto it = std::find_if(mSpatialPartition->mGroups.begin(), mSpatialPartition->mGroups.end(), [this](LLOcclusionCullingGroup* rhs) {return rhs == this; });
llassert_always(it != mSpatialPartition->mGroups.end());
llassert(it != mSpatialPartition->mGroups.end());
if (it != mSpatialPartition->mGroups.end())
{
mSpatialPartition->mGroups.erase(it);

View File

@@ -2946,7 +2946,7 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask)
{
{
// passing NULL here, character will be added later when it is handled by character handler.
gChatBar->startChat(NULL);
LLChatBar::startChat(NULL);
return TRUE;
}
}
@@ -3548,7 +3548,7 @@ void LLViewerWindow::updateLayout()
&& gFocusMgr.getKeyboardFocus() == NULL
&& gChatBar->isInVisibleChain())
{
gChatBar->startChat(NULL);
LLChatBar::startChat(NULL);
}
}