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

Deny dynamic JMP/JNE backwards jumps in predicates #359

Merged
merged 1 commit into from
Jun 21, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion specs/vm/main.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ For each such input in the transaction, the VM is [initialized](#vm-initializati
During predicate mode, hitting any of the following instructions causes predicate verification to halt, returning Boolean `false`:

1. Any [contract instruction](./instruction_set.md#contract-instructions).
1. [JI](./instruction_set.md#ji-jump-immediate) or [JNEI](./instruction_set.md#jnei-jump-if-not-equal-immediate) with jump-to value less than or equal to `$pc` (these would allow loops). In other words, `$pc` must be strictly increasing.
1. [JI](./instruction_set.md#ji-jump-immediate), [JNEI](./instruction_set.md#jnei-jump-if-not-equal-immediate), [JMP](./instruction_set.md#jmp-jump) or [JNE](./instruction_set.md#jne-jump-if-not-equal) with jump-to value less than or equal to `$pc` (these would allow loops). In other words, `$pc` must be strictly increasing.

In addition, during predicate mode if `$pc` is set to a value greater than the end of predicate bytecode (this would allow bytecode outside the actual predicate), predicate verification halts returning Boolean `false`.

Expand Down