Skip to content

Commit

Permalink
Merge pull request #684 from AntelopeIO/gh_425
Browse files Browse the repository at this point in the history
[1.0] Update `payloadless` contract to avoid UB in shift operator.
  • Loading branch information
greg7mdp authored Sep 3, 2024
2 parents 711d7a7 + e54ebd9 commit 21cec1f
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion unittests/test-contracts/payloadless/payloadless.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ bool is_prime(int p) {
bool is_mersenne_prime(int p) {
if (p == 2) return true;

const long long unsigned m_p = (1LLU << p) - 1;
long long unsigned s = 4;
const long long unsigned m_p = (1LLU << (p % (sizeof(s) * 8))) - 1;
int i;
for (i = 3; i <= p; i++) {
s = (s * s - 2) % m_p;
Expand Down
Binary file modified unittests/test-contracts/payloadless/payloadless.wasm
Binary file not shown.

0 comments on commit 21cec1f

Please sign in to comment.