Skip to content
This repository has been archived by the owner on Apr 12, 2021. It is now read-only.

fix: Check for overflows in safety checker #377

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,17 @@ contract OVM_SafetyChecker is iOVM_SafetyChecker {
// PUSH opcodes
uint256 opcodePushMask = ~uint256(0xffffffff000000000000000000000000);

uint256 codeLength;
uint256 _pc;
assembly {
_pc := add(_bytecode, 0x20)
}
codeLength = _pc + _bytecode.length;
uint256 codeLength = _pc + _bytecode.length;

// Simple overflow check.
if (codeLength < _pc) {
return false;
}

do {
// current opcode: 0x00...0xff
uint256 opNum;
Expand Down