From 7cc9a7911cde7f8307017ed033497f45e499c453 Mon Sep 17 00:00:00 2001 From: ricklentz Date: Tue, 6 Oct 2026 22:35:33 -0400 Subject: [PATCH] Fix VariableDatum getMarshalledSize() to compute padding correctly getMarshalledSize() used padding.length which is 0 before marshaling. The ByteBuffer marshal path then writes additional Align.to64bits() padding bytes, overflowing the pre-allocated buffer. Compute padding from the accumulated size instead, matching what Align.to64bits() will write. Fixes #36 --- src-generated/edu/nps/moves/dis7/pdus/VariableDatum.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src-generated/edu/nps/moves/dis7/pdus/VariableDatum.java b/src-generated/edu/nps/moves/dis7/pdus/VariableDatum.java index 5959b6b726..01fa1d6eb9 100644 --- a/src-generated/edu/nps/moves/dis7/pdus/VariableDatum.java +++ b/src-generated/edu/nps/moves/dis7/pdus/VariableDatum.java @@ -63,7 +63,7 @@ public synchronized int getMarshalledSize() { marshalSize += variableDatumID.getMarshalledSize(); marshalSize += 4; // variableDatumLength marshalSize += variableDatumValue.length; - marshalSize += padding.length; + marshalSize += (8 - marshalSize % 8) % 8; // pad to 64-bit boundary return marshalSize; }