Fixed
Details
Details
Assignee
Fabio Maulo
Fabio MauloReporter
Alun Harford
Alun HarfordComponents
Fix versions
Affects versions
Priority
Who's Looking?
Open Who's Looking?
Created July 21, 2008 at 2:02 AM
Updated July 22, 2008 at 2:37 PM
Resolved July 22, 2008 at 2:37 PM
namespace NHibernate.Mapping
{
...
public class Table : IRelationalModel
{
...
public string UniqueColumnString(IEnumerable iterator, string referencedEntityName)
{
...
return (name.GetHashCode().ToString("X") + result.GetHashCode().ToString("X")); // Ouch!
}
}
}
We've just hit a problem on this line where we have two constraints on the same table.
Because they're on the same table, name is the same.
And we have found a hash collision on result, due to weakness in how result is being generated.
Adding hashes together for string hashes isn't safe.
In our case,
"BluewireTechnologies.Core.Framework.DynamicTypes2.Albatross.ITestManyA".GetHashCode()+"itestmanyaid".GetHashCode()
Is equal to:
"BluewireTechnologies.Core.Framework.DynamicTypes2.Albatross.ITestManyB".GetHashCode()+"itestmanybid".GetHashCode()
On V2 runtime.