From 3f7139d3aa7a30f9f60126647f71f43e4c2ddc80 Mon Sep 17 00:00:00 2001 From: tevador Date: Thu, 9 May 2019 08:29:42 +0200 Subject: [PATCH] Fixed a possibility of buffer overflow in Superscalar generator --- src/superscalar.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/superscalar.cpp b/src/superscalar.cpp index a3130cb..012ff15 100644 --- a/src/superscalar.cpp +++ b/src/superscalar.cpp @@ -679,7 +679,7 @@ namespace randomx { //if we have issued all macro-ops for the current RandomX instruction, create a new instruction if (macroOpIndex >= currentInstruction.getInfo().getSize()) { - if (portsSaturated) + if (portsSaturated || programSize >= RANDOMX_SUPERSCALAR_MAX_SIZE) break; //select an instruction so that the first macro-op fits into the current slot currentInstruction.createForSlot(gen, decodeBuffer->getCounts()[bufferIndex], decodeBuffer->getIndex(), decodeBuffer->getSize() == bufferIndex + 1, bufferIndex == 0);