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

Validate the function signature of main in binaryen #446

Merged
merged 1 commit into from
Oct 25, 2018
Merged

Conversation

axic
Copy link
Member

@axic axic commented Oct 25, 2018

Part of #441. Fixes #442.

@codecov-io
Copy link

Codecov Report

Merging #446 into master will increase coverage by 0.12%.
The diff coverage is 100%.

@@            Coverage Diff             @@
##           master     #446      +/-   ##
==========================================
+ Coverage   68.51%   68.63%   +0.12%     
==========================================
  Files           8        8              
  Lines        1045     1049       +4     
  Branches      136      136              
==========================================
+ Hits          716      720       +4     
  Misses        300      300              
  Partials       29       29

@axic axic requested a review from chfast October 25, 2018 12:26
@axic axic force-pushed the validate-main-sig branch from fd448f2 to 733cb6c Compare October 25, 2018 12:26
@axic axic force-pushed the validate-main-sig branch from 733cb6c to 15b9dc2 Compare October 25, 2018 12:31
Copy link
Collaborator

@chfast chfast left a comment

Choose a reason for hiding this comment

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

Ok. I just suggested better error messages.

src/binaryen.cpp Outdated
ensureCondition(
main_function,
ContractValidationFailure,
"Contract is invalid. \"main\" export doesn't point to a function."
Copy link
Collaborator

Choose a reason for hiding this comment

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

"main" is not a function.

(main_function->getNumParams() == 0) &&
(main_function->result == wasm::Type::none),
ContractValidationFailure,
"Contract is invalid. \"main\" has an invalid signature."
Copy link
Collaborator

Choose a reason for hiding this comment

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

(The) "main" function has invalid signature

@axic axic force-pushed the validate-main-sig branch from 15b9dc2 to ab24465 Compare October 25, 2018 14:03
@axic axic merged commit b8640fe into master Oct 25, 2018
@axic axic removed the in progress label Oct 25, 2018
@axic axic deleted the validate-main-sig branch October 25, 2018 14:11
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.

3 participants