Repository navigation
Fix AggregateMarking.setCharacters() to preserve fixed 31-byte array - #42
Merged
Merged
Conversation
setCharacters() replaced the fixed 31-byte array with the caller's array, causing marshal to write fewer bytes than unmarshal reads. This byte-offset mismatch corrupted all subsequent fields including dimensions, producing garbage values after network round-trip. Use Arrays.copyOf() to preserve the fixed array length, matching the pattern already used by EntityMarking.setCharacters(). Closes #35
Merged
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Arrays.copyOf()inAggregateMarking.setCharacters()to preserve the fixed 31-byte array length, matchingEntityMarking.setCharacters()Root cause
setCharacters()replaced the fixed 31-bytecharactersarray with the caller's array (e.g. 8 bytes for "TestAgg1"). Marshal then wrote 8 bytes but unmarshal read 31, shifting all subsequent fields by 23 bytes and corruptingdimensions,orientation,centerOfMass, etc.The XML definition for
AggregateMarking.charactershaslength="31"but is missingfixedlength="true"(unlikeEntityMarking), so the generator produced a non-safe setter. The upstream fix is in open-dis/opendis7-source-generator (separate PR).Closes #35
Test plan