From e5a1243abc04c3f6f62e94425fea25b2ad84b577 Mon Sep 17 00:00:00 2001
From: Diva Canto
Date: Sat, 1 Aug 2015 18:58:05 -0700
Subject: Mantis #7657 and #7514. This should alleviate the problem of bad
object assets being passed around via HG and archives. No guarantees that all
the leaks have been found, but at least it detects and fixes these bad assets
upon: (1) storing and getting assets over HG -- assuming the core HG asset
service is being used (not the case with OSGrid!) (2) importing assets via
OAR and IAR
Instantiation of bad assets now should also work, instead of producing an exception, but the bad assets themselves aren't being fixed in the DB. That should be done with a cleaning tool -- see Perl script in Mantis #7657.
Virus!
---
OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 3 ++-
.../Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs | 7 ++++---
2 files changed, 6 insertions(+), 4 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index c14ce1e..dde54d5 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -37,6 +37,7 @@ using OpenMetaverse;
using OpenMetaverse.Packets;
using log4net;
using OpenSim.Framework;
+using OpenSim.Framework.Serialization.External;
using OpenSim.Region.Framework;
using OpenSim.Framework.Client;
using OpenSim.Region.Framework.Interfaces;
@@ -2225,7 +2226,7 @@ namespace OpenSim.Region.Framework.Scenes
bbox = Vector3.Zero;
offsetHeight = 0;
- string xmlData = Utils.BytesToString(assetData);
+ string xmlData = ExternalRepresentationUtils.SanitizeXml(Utils.BytesToString(assetData));
try
{
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
index cb13ca4..463ef22 100644
--- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
+++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
@@ -52,7 +52,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private static IUserManagement m_UserManagement;
-
+
///
/// Deserialize a scene object from the original xml format
///
@@ -60,7 +60,8 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
/// The scene object deserialized. Null on failure.
public static SceneObjectGroup FromOriginalXmlFormat(string xmlData)
{
- using (XmlTextReader wrappedReader = new XmlTextReader(xmlData, XmlNodeType.Element, null))
+ String fixedData = ExternalRepresentationUtils.SanitizeXml(xmlData);
+ using (XmlTextReader wrappedReader = new XmlTextReader(fixedData, XmlNodeType.Element, null))
using (XmlReader reader = XmlReader.Create(wrappedReader, new XmlReaderSettings() { IgnoreWhitespace = true, ConformanceLevel = ConformanceLevel.Fragment }))
return FromOriginalXmlFormat(reader);
}
@@ -322,7 +323,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
List sceneObjects = new List();
CoalescedSceneObjects coa = null;
- string xmlData = Utils.BytesToString(data);
+ string xmlData = ExternalRepresentationUtils.SanitizeXml(Utils.BytesToString(data));
if (CoalescedSceneObjectsSerializer.TryFromXml(xmlData, out coa))
{
--
cgit v1.1