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

[test] type and argument checking on host function dispatch #1155

Closed
4 tasks
graydon opened this issue Nov 1, 2023 · 1 comment · Fixed by #1213
Closed
4 tasks

[test] type and argument checking on host function dispatch #1155

graydon opened this issue Nov 1, 2023 · 1 comment · Fixed by #1213
Assignees
Labels
bug Something isn't working

Comments

@graydon
Copy link
Contributor

graydon commented Nov 1, 2023

  • for each host function:
    • invoke with wrong-typed args should fail
    • invoke with wrong-number of args should fail
    • invoke with an unknown object handle should fail
@graydon graydon added the bug Something isn't working label Nov 1, 2023
@jayz22 jayz22 self-assigned this Nov 6, 2023
@jayz22
Copy link
Contributor

jayz22 commented Nov 11, 2023

invoke with wrong-number of args should fail

I'm not sure how this can be done. The wasm code to call a function will have its type already encoded and will load the number of operands based on the arity, so if we were to leave an extra (or one less) operand on the stack before call it would just make the wasm module invalid.

github-merge-queue bot pushed a commit that referenced this issue Nov 16, 2023
### What

Resolves #1155

Add a macro that
- Generates synth-wasm for each host function
- For each type which appears in any host function, pass in an invalid
type and call the synth-wasm in a new test
- For every object type argument of a host function, pass in an invalid
object handle and call the synth-wasm in a new test

Catches and fixes three issues where invalid object handle isn't caught
early enough: `contract_event`, `require_auth`, `require_auth_for_args`.

---------

Co-authored-by: Graydon Hoare <graydon@pobox.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants