Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed timestamp_us overflow #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

epozzobon
Copy link

When packing timestamp_us into a 32-bit unsigned integer, struct.pack can throws an exception if the number is bigger than 2^32.

Some software sets the frame timestamp to be time.time(), meaning that the exception is thrown immediately. (see scapy: https://github.com/secdev/scapy/blob/master/scapy/contrib/cansocket_python_can.py#L319)

I would recommend doing a bitwise and with 0xffffffff to ensure the timestamp fits into the 32-bit integer

When packing timestamp_us into a 32-bit unsigned integer, struct.pack can throws an exception if the number is bigger than 2^32.

Some software sets the frame timestamp to be time.time(), meaning that the exception is thrown immediately.
(see scapy: https://github.com/secdev/scapy/blob/master/scapy/contrib/cansocket_python_can.py#L319)

I would recommend doing a bitwise and with 0xffffffff to ensure the timestamp fits into the 32-bit integer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant