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 15, 2024
1 parent 31760f8 commit 6bcacac
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 @@ -41,7 +41,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 @@ -60,12 +60,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 6bcacac

Please sign in to comment.