Skip to content

improve WasmValidator::validateMemBytes#1102

Merged
dschuff merged 1 commit intomasterfrom
check
Jul 19, 2017
Merged

improve WasmValidator::validateMemBytes#1102
dschuff merged 1 commit intomasterfrom
check

Conversation

@kripken
Copy link
Copy Markdown
Member

@kripken kripken commented Jul 18, 2017

Check for unreasonable sizes even if type is unreachable

// if we have a concrete type for the load, then we know the size of the mem operation and
// can validate it
if (type != unreachable) {
shouldBeEqual(getWasmTypeSize(type), 8U, curr, "8-byte mem operations are only allowed with 8-byte wasm types");
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Don't we already have shouldBeEqualOrFirstIsUnreachable that does exactly this?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It's similar, but that method is for comparing types. Here the first argument isn't the type, it's a computation based on the type, and it's invalid to do that computation if the type is unreachable (it asserts, as it is not valid to ask for the size of an unreachable type, only concrete types have sizes)

@dschuff
Copy link
Copy Markdown
Member

dschuff commented Jul 18, 2017

But yes, this is what I had in mind, thanks.

@dschuff
Copy link
Copy Markdown
Member

dschuff commented Jul 19, 2017

Got it, thanks! I'm going to go ahead and merge this so I can rebase on top of it.

@dschuff dschuff merged commit fa5165b into master Jul 19, 2017
@kripken kripken deleted the check branch July 24, 2017 16:12
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.

2 participants