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

Elmattic/actors review c1 #1368

Merged
merged 6 commits into from
Jan 21, 2022
Merged

Elmattic/actors review c1 #1368

merged 6 commits into from
Jan 21, 2022

Conversation

elmattic
Copy link
Contributor

Summary of changes
Changes introduced in this pull request:

  • Add size checks for both serialization and deserialization of BitField
  • Add size checks for deserialization of UnvalidatedBitField
  • Add corresponding tests
  • Add version check for deserialization of UnvalidatedBitField and corresponding test

Reference issue to close (if applicable)

Closes #1329, #1330

Other information and links

// a slice of runs, a bitfield of this size should not exceed 2MiB of memory.
//
// This bitfield can fit at least 3072 sparse elements.
const MAX_ENCODED_SIZE: usize = 32 << 10;
Copy link
Contributor

Choose a reason for hiding this comment

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

why not 1 << 15? i assume there is a reason, just curious!

Copy link
Contributor Author

@elmattic elmattic Jan 14, 2022

Choose a reason for hiding this comment

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

This is a copy pasta of the way go-bitfield defines the constant.
filecoin-project/go-bitfield@3478657

I guess they write it like this to make 32KiB more visible :)

@q9f
Copy link
Contributor

q9f commented Jan 20, 2022

Please rebase on main.

@q9f q9f merged commit 1aec44b into main Jan 21, 2022
@q9f q9f deleted the elmattic/actors-review-C1 branch January 21, 2022 10:45
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.

C1: Bitfield deserialization does not respect MAX_ENCODED_SIZE
3 participants