1
0
mirror of synced 2024-11-28 09:30:51 +01:00

pattern: Don't allow negative array sizes

This commit is contained in:
WerWolv 2022-02-11 16:52:51 +01:00
parent 0e40b8a81a
commit b4a3eb240e

View File

@ -969,7 +969,7 @@ namespace hex::pl {
evaluator->dataOffset() = startOffset;
u128 entryCount = 0;
i128 entryCount = 0;
if (this->m_size != nullptr) {
auto sizeNode = this->m_size->evaluate(evaluator);
@ -988,6 +988,9 @@ namespace hex::pl {
evaluator->handleAbort();
}
}
if (entryCount < 0)
LogConsole::abortEvaluation("array cannot have a negative size", this);
} else {
std::vector<u8> buffer(templatePattern->getSize());
while (true) {