mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-22 16:43:03 +01:00
Fixe bug #8083 : AV when writting into internal trace log
This commit is contained in:
parent
003b2e0a77
commit
4cc3ebe37d
@ -238,10 +238,24 @@ void TraceLog::extend(FB_SIZE_T size)
|
||||
const FB_SIZE_T toMoveR = oldSize - header->readPos;
|
||||
|
||||
char* data = reinterpret_cast<char*> (header);
|
||||
const FB_SIZE_T deltaSize = newSize - oldSize;
|
||||
|
||||
if (toMoveW < toMoveR)
|
||||
{
|
||||
memcpy(data + oldSize, data + sizeof(TraceLogHeader), toMoveW);
|
||||
header->writePos = oldSize + toMoveW;
|
||||
if (toMoveW <= deltaSize)
|
||||
{
|
||||
memcpy(data + oldSize, data + sizeof(TraceLogHeader), toMoveW);
|
||||
header->writePos = oldSize + toMoveW;
|
||||
|
||||
if (header->writePos == header->allocated)
|
||||
header->writePos = sizeof(TraceLogHeader);
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy(data + oldSize, data + sizeof(TraceLogHeader), deltaSize);
|
||||
memcpy(data + sizeof(TraceLogHeader), data + sizeof(TraceLogHeader) + deltaSize, toMoveW - deltaSize);
|
||||
header->writePos -= deltaSize;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user