Skip to content

Commit

Permalink
Merge pull request eclipse-omr#3851 from wbh123456/SignedIntegerOverflow
Browse files Browse the repository at this point in the history
Use unsigned integer for hashing algorithm
  • Loading branch information
Leonardo2718 authored May 15, 2019
2 parents 11fc810 + 55f5cf6 commit 2d1e785
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions compiler/compile/OMRCompilation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -333,10 +333,10 @@ OMR::Compilation::Compilation(
_adhocRandom = new (m->trHeapMemory()) TR_RandomGenerator(options.getRandomSeed());
if (options.getOption(TR_RandomSeedSignatureHash))
{
int32_t hash = 0;
uint32_t hash = 0;
for (const char *c = self()->signature(); *c; c++)
hash = 33*hash + (int32_t)(*c);
int32_t seed = _options->getRandomSeed();
hash = 33*hash + (uint32_t)(*c);
uint32_t seed = _options->getRandomSeed();
seed ^= hash;
_primaryRandom->setSeed(seed);
_adhocRandom->setSeed(_primaryRandom->getRandom());
Expand Down

0 comments on commit 2d1e785

Please sign in to comment.