Skip to content

Commit

Permalink
Merge pull request #687 from AntelopeIO/gh_425_main
Browse files Browse the repository at this point in the history
[1.0 -> main] Update payloadless contract to avoid UB in shift operator.
  • Loading branch information
greg7mdp authored Sep 3, 2024
2 parents 53b2392 + dab3534 commit f46d5c0
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 f46d5c0

Please sign in to comment.