Repository navigation
Fix silent overflow in 24/40/48/56-bit integer packing - #687
Open
VolMax-Studio wants to merge 1 commit into
Open
VolMax-Studio wants to merge 1 commit into
VolMax-Studio wants to merge 1 commit into
Conversation
Signed-off-by: VolMax-Studio <volmax.core@gmail.com>
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.
UnsignedN.pack()andIntegerN.pack()pack into a wider standard integer type and truncate the result. For 24-, 40-, 48-, and 56-bit types, values outside the declared width can therefore wrap silently rather than raise an error.Validate the narrow-width range after
struct.Struct.pack(), preservingstruct.errorinternally and the existingODVariable.encode_raw()ValueErrorbehavior.Regression tests cover both signed and unsigned boundaries, invalid values, and the public encoding API. All tests run against current
master.Validation
pytest -q: 283 passed, 1 skipped (231 subtests passed).unittest discover -s . -p 'test_*.py' -q: 284 tests, OK (1 skipped).ruff check canopen/objectdictionary/datatypes.py test/test_od.py: passed.