summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
Diffstat (limited to 'indra')
-rw-r--r--indra/llui/lltextbase.cpp8
-rw-r--r--indra/newview/gltf/buffer_util.h14
-rw-r--r--indra/newview/llinventorypanel.cpp6
3 files changed, 25 insertions, 3 deletions
diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp
index 7007049e1c..382847d68f 100644
--- a/indra/llui/lltextbase.cpp
+++ b/indra/llui/lltextbase.cpp
@@ -1069,6 +1069,14 @@ S32 LLTextBase::insertStringNoUndo(S32 pos, const LLWString &wstr, LLTextBase::s
S32 LLTextBase::removeStringNoUndo(S32 pos, S32 length)
{
+ S32 text_length = (S32)getLength();
+ if (pos >= text_length || pos < 0)
+ {
+ return 0; // nothing to remove
+ }
+ // Clamp length to not go past the end of the text
+ length = std::min(length, text_length - pos);
+
beforeValueChange();
segment_set_t::iterator seg_iter = getSegIterContaining(pos);
while(seg_iter != mSegments.end())
diff --git a/indra/newview/gltf/buffer_util.h b/indra/newview/gltf/buffer_util.h
index be36c5e90b..c231443a9e 100644
--- a/indra/newview/gltf/buffer_util.h
+++ b/indra/newview/gltf/buffer_util.h
@@ -147,6 +147,12 @@ namespace LL
}
template<>
+ inline void copyVec3<F32, LLVector2>(F32* src, LLVector2& dst)
+ {
+ dst.set(src[0], src[1]);
+ }
+
+ template<>
inline void copyVec3<F32, vec3>(F32* src, vec3& dst)
{
dst = vec3(src[0], src[1], src[2]);
@@ -375,12 +381,18 @@ namespace LL
template<class T>
inline void copy(Asset& asset, Accessor& accessor, LLStrider<T>& dst)
{
- if (accessor.mBufferView == INVALID_INDEX)
+ if (accessor.mBufferView == INVALID_INDEX
+ || accessor.mBufferView >= asset.mBufferViews.size())
{
LL_WARNS("GLTF") << "Invalid buffer" << LL_ENDL;
return;
}
const BufferView& bufferView = asset.mBufferViews[accessor.mBufferView];
+ if (bufferView.mBuffer >= asset.mBuffers.size())
+ {
+ LL_WARNS("GLTF") << "Invalid buffer view" << LL_ENDL;
+ return;
+ }
const Buffer& buffer = asset.mBuffers[bufferView.mBuffer];
const U8* src = buffer.mData.data() + bufferView.mByteOffset + accessor.mByteOffset;
diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp
index a06e64b1dc..0da7e35c38 100644
--- a/indra/newview/llinventorypanel.cpp
+++ b/indra/newview/llinventorypanel.cpp
@@ -771,6 +771,7 @@ void LLInventoryPanel::itemChanged(const LLUUID& item_id, U32 mask, const LLInve
// Remove the item's UI.
LLFolderViewFolder* parent = view_item->getParentFolder();
removeItemID(viewmodel_item->getUUID());
+ bool was_favorite = view_item->isFavorite();
view_item->destroyView();
if(parent)
{
@@ -784,7 +785,7 @@ void LLInventoryPanel::itemChanged(const LLUUID& item_id, U32 mask, const LLInve
updateFolderLabel(viewmodel_folder->getUUID());
}
}
- if (view_item->isFavorite())
+ if (was_favorite)
{
parent->updateHasFavorites(false); // favorite was removed
}
@@ -2458,6 +2459,7 @@ bool LLInventoryFavoritesItemsPanel::removeFavorite(const LLUUID& id, const LLIn
{
removeItemID(viewmodel_item->getUUID());
}
+ bool was_favorite = view_item->isFavorite();
view_item->destroyView();
if (parent)
{
@@ -2467,7 +2469,7 @@ bool LLInventoryFavoritesItemsPanel::removeFavorite(const LLUUID& id, const LLIn
{
updateFolderLabel(viewmodel_folder->getUUID());
}
- if (view_item->isFavorite())
+ if (was_favorite)
{
parent->updateHasFavorites(false); // favorite was removed
}