There is an extremely rare case where a specific string could cause an overflow error when calling MPIHasher.hashString() due to not using the overflow addition operator. I've changed the code from a regular addition to overflow addition which matches the original Objective-C logic and was the intended behavior.
Testing Plan
Due to the nature of this hash function I was unable to write a unit test to reproduce the bug, but I reproduced it manually by setting var hash: Int32 = Int32.max to confirm that it was hypothetically possible and that switching to the overflow addition operator fixes the issue.
Reference Issue (For mParticle employees only. Ignore if you are an outside contributor)
Summary
There is an extremely rare case where a specific string could cause an overflow error when calling
MPIHasher.hashString()
due to not using the overflow addition operator. I've changed the code from a regular addition to overflow addition which matches the original Objective-C logic and was the intended behavior.Testing Plan
Due to the nature of this hash function I was unable to write a unit test to reproduce the bug, but I reproduced it manually by setting
var hash: Int32 = Int32.max
to confirm that it was hypothetically possible and that switching to the overflow addition operator fixes the issue.Reference Issue (For mParticle employees only. Ignore if you are an outside contributor)