From d42f404b12f9d63de2e00fc7caf122e87d971724 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Bylica?= Date: Thu, 18 Jun 2015 16:37:23 +0200 Subject: [PATCH] Fix int comparison. --- libevm/VM.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libevm/VM.cpp b/libevm/VM.cpp index 062581563..2b2ada0ae 100644 --- a/libevm/VM.cpp +++ b/libevm/VM.cpp @@ -212,11 +212,11 @@ bytesConstRef VM::execImpl(u256& io_gas, ExtVMFace& _ext, OnOpFunc const& _onOp) auto size = static_cast(_stack.back()); _stack.pop_back(); - auto sizeToBeCopied = bigIndex + size > _data.size() ? _data.size() < bigIndex ? 0 : _data.size() - index : size; + size_t sizeToBeCopied = bigIndex + size > _data.size() ? _data.size() < bigIndex ? 0 : _data.size() - index : size; if (sizeToBeCopied > 0) std::memcpy(_memory.data() + offset, _data.data() + index, sizeToBeCopied); - if (size - sizeToBeCopied > 0) + if (size > sizeToBeCopied) std::memset(_memory.data() + offset + sizeToBeCopied, 0, size - sizeToBeCopied); };