From 95f0d582a51ed91c24e03ea2c16d87ac3f416a22 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sun, 20 Jul 2014 00:17:35 +0200 Subject: [PATCH 1/5] Fix coalesced objects not showing up as "piles" of prims (AVN only bug) --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 7c62f9017b..5ee159600a 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -1737,7 +1737,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP newBlock.CreationDate = item.CreationDate; newBlock.SalePrice = item.SalePrice; newBlock.SaleType = item.SaleType; - newBlock.Flags = item.Flags & 0xff; + newBlock.Flags = item.Flags & 0x2000ff; newBlock.CRC = Helpers.InventoryCRC(newBlock.CreationDate, newBlock.SaleType, @@ -1991,7 +1991,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP itemBlock.GroupID = item.GroupID; itemBlock.GroupOwned = item.GroupOwned; itemBlock.GroupMask = item.GroupPermissions; - itemBlock.Flags = item.Flags & 0xff; + itemBlock.Flags = item.Flags & 0x2000ff; itemBlock.SalePrice = item.SalePrice; itemBlock.SaleType = item.SaleType; itemBlock.CreationDate = item.CreationDate; @@ -2058,7 +2058,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP bulkUpdate.ItemData[0].GroupID = item.GroupID; bulkUpdate.ItemData[0].GroupOwned = item.GroupOwned; bulkUpdate.ItemData[0].GroupMask = item.GroupPermissions; - bulkUpdate.ItemData[0].Flags = item.Flags & 0xff; + bulkUpdate.ItemData[0].Flags = item.Flags & 0x2000ff; bulkUpdate.ItemData[0].SalePrice = item.SalePrice; bulkUpdate.ItemData[0].SaleType = item.SaleType; @@ -2112,7 +2112,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP InventoryReply.InventoryData[0].GroupID = Item.GroupID; InventoryReply.InventoryData[0].GroupOwned = Item.GroupOwned; InventoryReply.InventoryData[0].GroupMask = Item.GroupPermissions; - InventoryReply.InventoryData[0].Flags = Item.Flags & 0xff; + InventoryReply.InventoryData[0].Flags = Item.Flags & 0x2000ff; InventoryReply.InventoryData[0].SalePrice = Item.SalePrice; InventoryReply.InventoryData[0].SaleType = Item.SaleType; InventoryReply.InventoryData[0].CreationDate = Item.CreationDate; From c6cdd597f3ac0165d73a152b23a3abbbceb9a96e Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 8 Aug 2014 01:32:16 +0100 Subject: [PATCH 2/5] add wearables array size checks on unpack --- OpenSim/Framework/AvatarAppearance.cs | 14 ++++++++++++-- OpenSim/Framework/ChildAgentDataUpdate.cs | 7 ++++++- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index a34c85f531..55e4b40bce 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -458,7 +458,12 @@ namespace OpenSim.Framework // m_log.WarnFormat("[AVATARAPPEARANCE] set wearable {0} --> {1}:{2}",wearableId,wearable.ItemID,wearable.AssetID); // DEBUG OFF m_wearables[wearableId].Clear(); - for (int i = 0; i < wearable.Count; i++) + + int count = wearable.Count; + if (count > AvatarWearable.MAX_WEARABLES) + count = AvatarWearable.MAX_WEARABLES; + + for (int i = 0; i < count; i++) m_wearables[wearableId].Add(wearable[i].ItemID, wearable[i].AssetID); } @@ -751,7 +756,12 @@ namespace OpenSim.Framework if ((data != null) && (data["wearables"] != null) && (data["wearables"]).Type == OSDType.Array) { OSDArray wears = (OSDArray)(data["wearables"]); - for (int i = 0; i < wears.Count; i++) + + int count = wears.Count; + if (count > AvatarWearable.MAX_WEARABLES) + count = AvatarWearable.MAX_WEARABLES; + + for (int i = 0; i < count; i++) m_wearables[i] = new AvatarWearable((OSDArray)wears[i]); } else diff --git a/OpenSim/Framework/ChildAgentDataUpdate.cs b/OpenSim/Framework/ChildAgentDataUpdate.cs index 8c32734980..967278e543 100644 --- a/OpenSim/Framework/ChildAgentDataUpdate.cs +++ b/OpenSim/Framework/ChildAgentDataUpdate.cs @@ -657,7 +657,12 @@ namespace OpenSim.Framework if ((args["wearables"] != null) && (args["wearables"]).Type == OSDType.Array) { OSDArray wears = (OSDArray)(args["wearables"]); - for (int i = 0; i < wears.Count / 2; i++) + + int count = wears.Count; + if (count > AvatarWearable.MAX_WEARABLES) + count = AvatarWearable.MAX_WEARABLES; + + for (int i = 0; i < count / 2; i++) { AvatarWearable awear = new AvatarWearable((OSDArray)wears[i]); Appearance.SetWearable(i,awear); From 0e809ab2658d9aff51d7a12754630ccfec977b79 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sun, 10 Aug 2014 22:00:01 +0200 Subject: [PATCH 3/5] LSL llListFindList fix: check types as well as content. Items must be same type to be found. --- .../Shared/Api/Implementation/LSL_Api.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 3f0af6dcd6..e72b3dde3b 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -5950,17 +5950,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { for (int i = 0; i < length; i++) { + int needle = llGetListEntryType(test, 0).value; + int haystack = llGetListEntryType(src, i).value; + // Why this piece of insanity? This is because most script constants are C# value types (e.g. int) // rather than wrapped LSL types. Such a script constant does not have int.Equal(LSL_Integer) code // and so the comparison fails even if the LSL_Integer conceptually has the same value. // Therefore, here we test Equals on both the source and destination objects. // However, a future better approach may be use LSL struct script constants (e.g. LSL_Integer(1)). - if (src.Data[i].Equals(test.Data[0]) || test.Data[0].Equals(src.Data[i])) + if ((needle == haystack) && (src.Data[i].Equals(test.Data[0]) || test.Data[0].Equals(src.Data[i]))) { int j; for (j = 1; j < test.Length; j++) - if (!(src.Data[i+j].Equals(test.Data[j]) || test.Data[j].Equals(src.Data[i+j]))) + { + needle = llGetListEntryType(test, j).value; + haystack = llGetListEntryType(src, i+j).value; + + if ((needle != haystack) || (!(src.Data[i+j].Equals(test.Data[j]) || test.Data[j].Equals(src.Data[i+j])))) break; + } if (j == test.Length) { From 036017bba7195d052efa9eb4d289c87cd38515e0 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Mon, 11 Aug 2014 02:07:23 +0200 Subject: [PATCH 4/5] Make texture anims work right on singu --- .../Framework/Scenes/SceneObjectPart.cs | 31 ++++++++++++------- 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 261e9584e9..a3c60ea903 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1880,22 +1880,29 @@ namespace OpenSim.Region.Framework.Scenes public void AddTextureAnimation(Primitive.TextureAnimation pTexAnim) { - byte[] data = new byte[16]; - int pos = 0; + if (((int)pTexAnim.Flags & 1) == 0) // ANIM_ON + { + byte[] data = new byte[16]; + int pos = 0; - // The flags don't like conversion from uint to byte, so we have to do - // it the crappy way. See the above function :( + // The flags don't like conversion from uint to byte, so we have to do + // it the crappy way. See the above function :( - data[pos] = ConvertScriptUintToByte((uint)pTexAnim.Flags); pos++; - data[pos] = (byte)pTexAnim.Face; pos++; - data[pos] = (byte)pTexAnim.SizeX; pos++; - data[pos] = (byte)pTexAnim.SizeY; pos++; + data[pos] = ConvertScriptUintToByte((uint)pTexAnim.Flags); pos++; + data[pos] = (byte)pTexAnim.Face; pos++; + data[pos] = (byte)pTexAnim.SizeX; pos++; + data[pos] = (byte)pTexAnim.SizeY; pos++; - Utils.FloatToBytes(pTexAnim.Start).CopyTo(data, pos); - Utils.FloatToBytes(pTexAnim.Length).CopyTo(data, pos + 4); - Utils.FloatToBytes(pTexAnim.Rate).CopyTo(data, pos + 8); + Utils.FloatToBytes(pTexAnim.Start).CopyTo(data, pos); + Utils.FloatToBytes(pTexAnim.Length).CopyTo(data, pos + 4); + Utils.FloatToBytes(pTexAnim.Rate).CopyTo(data, pos + 8); - m_TextureAnimation = data; + m_TextureAnimation = data; + } + else + { + m_TextureAnimation = Utils.EmptyBytes; + } } public void AdjustSoundGain(double volume) From 0eaabef1dc8ac18319fa77c699e50226df5ca2bd Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Mon, 11 Aug 2014 02:30:09 +0200 Subject: [PATCH 5/5] Fix a condition check --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index a3c60ea903..566605a6d2 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1880,7 +1880,7 @@ namespace OpenSim.Region.Framework.Scenes public void AddTextureAnimation(Primitive.TextureAnimation pTexAnim) { - if (((int)pTexAnim.Flags & 1) == 0) // ANIM_ON + if (((int)pTexAnim.Flags & 1) != 0) // ANIM_ON { byte[] data = new byte[16]; int pos = 0;