Do not attempt to allocate >= 4 GiB on 32-bit systems (#99)

+ Cache size limited to 2 GiB
This commit is contained in:
tevador
2019-07-09 20:26:50 +02:00
committed by GitHub
parent 41401797c9
commit 47ade5e894
3 changed files with 9 additions and 1 deletions

View File

@@ -34,6 +34,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "vm_compiled_light.hpp"
#include "blake2/blake2.h"
#include <cassert>
#include <limits>
extern "C" {
@@ -102,6 +103,12 @@ extern "C" {
}
randomx_dataset *randomx_alloc_dataset(randomx_flags flags) {
//fail on 32-bit systems if DatasetSize is >= 4 GiB
if (randomx::DatasetSize > std::numeric_limits<size_t>::max()) {
return nullptr;
}
randomx_dataset *dataset;
try {