From 3012bfa2a2ff97cc18c02cba7b533cfa818dfee4 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sun, 28 Sep 2008 19:58:54 +0000 Subject: [PATCH] Mantis #1922 Thank you, idb, for a patch that addresses hex digits erroneously being recognized as valid and parsed in a decimal number --- OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs | 2 +- .../Region/ScriptEngine/Shared/Tests/LSL_TypesTestLSLInteger.cs | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs index 4c4eff98ac..5f8b541e19 100644 --- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs +++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs @@ -1436,7 +1436,7 @@ namespace OpenSim.Region.ScriptEngine.Shared public LSLInteger(string s) { - Regex r = new Regex("^[ ]*-?[0-9][0-9xX]?[0-9a-fA-F]*"); + Regex r = new Regex("(^[ ]*0[xX][0-9A-Fa-f][0-9A-Fa-f]*)|(^[ ]*-?[0-9][0-9]*)"); Match m = r.Match(s); string v = m.Groups[0].Value; diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestLSLInteger.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestLSLInteger.cs index 957a3b6a63..1d3ffd5e9a 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestLSLInteger.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestLSLInteger.cs @@ -64,6 +64,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests m_stringIntSet.Add("-99999999", -99999999); m_stringIntSet.Add("", 0); m_stringIntSet.Add("aa", 0); + m_stringIntSet.Add("56foo", 56); m_stringIntSet.Add("42", 42); m_stringIntSet.Add("42 is the answer", 42); m_stringIntSet.Add(" 42", 42);