Thank you, idb, for a patch that addresses hex digits erroneously being
recognized as valid and parsed in a decimal number
0.6.0-stable
Melanie Thielker 2008-09-28 19:58:54 +00:00
parent 1d5b2bb8bc
commit 3012bfa2a2
2 changed files with 2 additions and 1 deletions

View File

@ -1436,7 +1436,7 @@ namespace OpenSim.Region.ScriptEngine.Shared
public LSLInteger(string s) 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); Match m = r.Match(s);
string v = m.Groups[0].Value; string v = m.Groups[0].Value;

View File

@ -64,6 +64,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
m_stringIntSet.Add("-99999999", -99999999); m_stringIntSet.Add("-99999999", -99999999);
m_stringIntSet.Add("", 0); m_stringIntSet.Add("", 0);
m_stringIntSet.Add("aa", 0); m_stringIntSet.Add("aa", 0);
m_stringIntSet.Add("56foo", 56);
m_stringIntSet.Add("42", 42); m_stringIntSet.Add("42", 42);
m_stringIntSet.Add("42 is the answer", 42); m_stringIntSet.Add("42 is the answer", 42);
m_stringIntSet.Add(" 42", 42); m_stringIntSet.Add(" 42", 42);