Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix dataword #3472

Merged
merged 1 commit into from Oct 27, 2020
Merged

fix dataword #3472

merged 1 commit into from Oct 27, 2020

Conversation

taihaofu
Copy link
Contributor

What does this PR do?

Why are these changes required?

This PR has been tested by:

  • Unit Tests
  • Manual Testing

Follow up

Extra details

@@ -1178,7 +1178,7 @@ public DataWord getBlockHash(int index) {
BlockCapsule blockCapsule = contractState.getBlockByNum(index);

if (Objects.nonNull(blockCapsule)) {
return new DataWord(blockCapsule.getBlockId().getBytes());
return new DataWord(blockCapsule.getBlockId().getBytes()).clone();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The constructor of DataWord should be changed, instead of any caller position.

A DataWord must not point to any non-owned memory.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Annyminous hackers love it

Copy link
Contributor

@zhangheng1536 zhangheng1536 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@taihaofu taihaofu merged commit cecf3f1 into release_v4.1 Oct 27, 2020
7 checks passed
@ethan1844 ethan1844 deleted the Hotfix/dataword_41 branch March 30, 2022 10:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants