fix: Fixes pool of acid and other empty serializations (#1025)
Fixes an issue where 0 byte objects are improperly deserialized. They should not be deserialized at all and instead deleted.
This commit is contained in:
parent
6b3617b08f
commit
dfdadd3204
1 changed files with 12 additions and 0 deletions
|
|
@ -200,6 +200,12 @@ namespace Server
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (entry.Length == 0)
|
||||||
|
{
|
||||||
|
t.Delete();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
var buffer = GC.AllocateUninitializedArray<byte>(entry.Length);
|
var buffer = GC.AllocateUninitializedArray<byte>(entry.Length);
|
||||||
if (br == null)
|
if (br == null)
|
||||||
{
|
{
|
||||||
|
|
@ -310,6 +316,12 @@ namespace Server
|
||||||
{
|
{
|
||||||
var saveBuffer = entity.SaveBuffer;
|
var saveBuffer = entity.SaveBuffer;
|
||||||
|
|
||||||
|
// If nothing was serialized we expect the object to be deleted on deserialization
|
||||||
|
if (saveBuffer.Position == 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Resize to the exact size
|
// Resize to the exact size
|
||||||
saveBuffer.Resize((int)saveBuffer.Position);
|
saveBuffer.Resize((int)saveBuffer.Position);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue