[*] clamp head positions during non-circular realloc

This commit is contained in:
Reece Wilson 2023-04-29 07:34:00 +01:00
parent 6683d3cfdc
commit cc317882e9

View File

@ -177,6 +177,13 @@ namespace Aurora::Memory
oldWriteIdx = this->writePtr - this->base;
oldReadIdx = this->readPtr - this->base;
if (!flagCircular)
{
oldWriteIdx = AuMin<AuUInt>(length, oldWriteIdx);
oldReadIdx = AuMin<AuUInt>(length, oldReadIdx);
}
nextRead = nextPtr + oldReadIdx;
nextWrite = nextPtr + oldWriteIdx;