From b383cdae339631d009a07cde4f10fcd3d61d9e77 Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Wed, 28 Oct 2015 21:27:56 +0000
Subject: fix cut points of UTF-8 strings
---
OpenSim/Framework/Util.cs | 38 ++++++++++++++++++++++++++++----------
1 file changed, 28 insertions(+), 10 deletions(-)
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index a5f798d..1f74168 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -1818,17 +1818,26 @@ namespace OpenSim.Framework
///
public static byte[] StringToBytes256(string str)
{
- if (String.IsNullOrEmpty(str)) { return Utils.EmptyBytes; }
- if (str.Length > 254) str = str.Remove(254);
- if (!str.EndsWith("\0")) { str += "\0"; }
+ if (String.IsNullOrEmpty(str))
+ return Utils.EmptyBytes;
+
+ if (!str.EndsWith("\0"))
+ str += "\0";
// Because this is UTF-8 encoding and not ASCII, it's possible we
// might have gotten an oversized array even after the string trim
byte[] data = UTF8.GetBytes(str);
+
if (data.Length > 256)
{
- Array.Resize(ref data, 256);
- data[255] = 0;
+ int cut = 255;
+ if((data[cut] & 0x80 ) != 0 )
+ {
+ while(cut > 0 && (data[cut] & 0xc0) != 0xc0)
+ cut--;
+ }
+ Array.Resize(ref data, cut + 1);
+ data[cut] = 0;
}
return data;
@@ -1860,17 +1869,26 @@ namespace OpenSim.Framework
///
public static byte[] StringToBytes1024(string str)
{
- if (String.IsNullOrEmpty(str)) { return Utils.EmptyBytes; }
- if (str.Length > 1023) str = str.Remove(1023);
- if (!str.EndsWith("\0")) { str += "\0"; }
+ if (String.IsNullOrEmpty(str))
+ return Utils.EmptyBytes;
+
+ if (!str.EndsWith("\0"))
+ str += "\0";
// Because this is UTF-8 encoding and not ASCII, it's possible we
// might have gotten an oversized array even after the string trim
byte[] data = UTF8.GetBytes(str);
+
if (data.Length > 1024)
{
- Array.Resize(ref data, 1024);
- data[1023] = 0;
+ int cut = 1023;
+ if((data[cut] & 0x80 ) != 0 )
+ {
+ while(cut > 0 && (data[cut] & 0xc0) != 0xc0)
+ cut--;
+ }
+ Array.Resize(ref data, cut + 1);
+ data[cut] = 0;
}
return data;
--
cgit v1.1
From 554d4bad8d8ad191fe91e30e2fe40cb184d5b964 Mon Sep 17 00:00:00 2001
From: Diva Canto
Date: Thu, 12 Nov 2015 18:40:10 -0800
Subject: Fixed typos
---
bin/OpenSimDefaults.ini | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini
index 9002650..a99608c 100644
--- a/bin/OpenSimDefaults.ini
+++ b/bin/OpenSimDefaults.ini
@@ -167,13 +167,13 @@
InworldRestartShutsDown = false
; Use of normalized 55FPS statistics
- ; Opensim does not have a frame rate control like other simulators
- ; Most parameters that control timing can be configurable region by region
- ; To achive closer compatibility with values expected by viewers, scripts and users
+ ; Opensim does not have a frame rate control like other simulators.
+ ; Most parameters that control timing can be configurable region by region.
+ ; To achieve closer compatibility with values expected by viewers, scripts and users
; some parameters are converted to a equivalent per frame value.
- ; Adicionaly they are scaled to values they whould have on a system running at a nominal 55 frames per second rate
+ ; Additionally, they are scaled to values they would have on a system running at a nominal 55 frames per second rate.
; The scale factor it 55 * FrameTime, corresponding to 5 with default configuration
- ; You can choose to not apply this scale factor setting Normalized55FPS to false.
+ ; You can choose to show the true physics FPS to viewers by setting Normalized55FPS to false.
; Normalized55FPS = true
; The minimum proportion of a second that any particular frame can take to execute.
--
cgit v1.1
From bcb27d44062c478508f1cd5d211d204b2f151e8a Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Sun, 15 Nov 2015 08:16:52 +0000
Subject: fix the protection for more Wearables than region suports
---
OpenSim/Framework/AvatarAppearance.cs | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs
index f442fc2..e1725a9 100644
--- a/OpenSim/Framework/AvatarAppearance.cs
+++ b/OpenSim/Framework/AvatarAppearance.cs
@@ -458,11 +458,11 @@ namespace OpenSim.Framework
// m_log.WarnFormat("[AVATARAPPEARANCE] set wearable {0} --> {1}:{2}",wearableId,wearable.ItemID,wearable.AssetID);
// DEBUG OFF
m_wearables[wearableId].Clear();
- 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);
+ 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);
}
// DEBUG ON
@@ -760,7 +760,10 @@ 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
--
cgit v1.1