Skip to content

Commit

Permalink
Fix nondeterminism in DC serialization due to uninitialized padding.
Browse files Browse the repository at this point in the history
  • Loading branch information
alexrp committed Jul 14, 2024
1 parent 4e858ef commit fdedbd0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public static void Write(ref SpanWriter writer, DataCenterArchitecture architect
writer.WriteInt32(item.Value);

if (architecture == DataCenterArchitecture.X64)
writer.Advance(sizeof(uint));
writer.WriteUInt32(0); // Write a deterministic padding value.
}

public readonly bool Equals(DataCenterRawAttribute other)
Expand Down
4 changes: 2 additions & 2 deletions src/formats/Data/Serialization/Items/DataCenterRawNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,12 @@ public static void Write(ref SpanWriter writer, DataCenterArchitecture architect
DataCenterRawAddress.Write(ref writer, architecture, item.AttributeAddress);

if (architecture == DataCenterArchitecture.X64)
writer.Advance(sizeof(uint));
writer.WriteUInt32(0); // Write a deterministic padding value.

DataCenterRawAddress.Write(ref writer, architecture, item.ChildAddress);

if (architecture == DataCenterArchitecture.X64)
writer.Advance(sizeof(uint));
writer.WriteUInt32(0); // Write a deterministic padding value.
}

public readonly bool Equals(DataCenterRawNode other)
Expand Down

0 comments on commit fdedbd0

Please sign in to comment.