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

Spec for Memory object's constructor does not check maximum >= initial #876

Closed
lars-t-hansen opened this issue Sep 14, 2018 · 4 comments
Closed

Comments

@lars-t-hansen
Copy link

lars-t-hansen commented Sep 14, 2018

The descriptor passed to WebAssembly.Memory's constructor has two fields, initial and maximum, where maximum is optional. If maximum is present then there needs to be a check that it is no smaller than than initial, but there's no such check. WebAssembly.Table's constructor does have such a check.

EDIT: Fixed ">" to ">=", though subject line and @binji's PR were both correct, so editorial only.

@lars-t-hansen lars-t-hansen changed the title Spec for Memory object's constructor does not clamp maximum >= initial Spec for Memory object's constructor does not check maximum >= initial Sep 14, 2018
binji added a commit that referenced this issue Sep 14, 2018
@lukewagner
Copy link
Member

Good spot! It seems like ideally this validation of the limits would happen using the core spec's validation rule for memory types and table types. Maybe the simplest place for this might be in the core spec alloc_mem and alloc_table functions, so that the wasm core spec is preserving its own validation invariants? WDYT @rossberg?

@lukewagner
Copy link
Member

lukewagner commented Sep 17, 2018

Oops, I hadn't reached #877 yet in my bugmail. Either approach works, I suppose.

@rossberg
Copy link
Member

@lukewagner, yes it would make sense to add these as explicit pre/side conditions. I'll do that.

binji added a commit that referenced this issue Sep 18, 2018
@littledan
Copy link
Collaborator

Closing per #877

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

No branches or pull requests

4 participants