Skip to content

Commit

Permalink
Fix emitting DehydratedDataCommand.ZeroFill when alignment is high (d…
Browse files Browse the repository at this point in the history
…otnet#82155)

The alignment might not fit into a single byte.
  • Loading branch information
MichalStrehovsky authored Feb 15, 2023
1 parent 45c314f commit 07f10e7
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,10 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false)
int oldPosition = dehydratedSegmentPosition;
dehydratedSegmentPosition = dehydratedSegmentPosition.AlignUp(o.Alignment);
if (dehydratedSegmentPosition > oldPosition)
builder.EmitByte(DehydratedDataCommand.EncodeShort(DehydratedDataCommand.ZeroFill, dehydratedSegmentPosition - oldPosition));
{
int written = DehydratedDataCommand.Encode(DehydratedDataCommand.ZeroFill, dehydratedSegmentPosition - oldPosition, buff);
builder.EmitBytes(buff, 0, written);
}
}

int currentReloc = 0;
Expand Down

0 comments on commit 07f10e7

Please sign in to comment.