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

Fix LightPcapNg timestamp calculation #1535

Merged
merged 2 commits into from
Aug 14, 2024
Merged

Conversation

seladb
Copy link
Owner

@seladb seladb commented Aug 14, 2024

The change introduced in this PR: #1514
Doesn't take into account cases where ticks_per_sec is zero. This PR fixes it

@@ -422,7 +422,7 @@ int light_get_next_packet(light_pcapng_t *pcapng, light_packet_header *packet_he
timestamp = timestamp << 32;
timestamp += epb->timestamp_low;
uint64_t ticks_per_sec = pcapng->file_info->timestamp_ticks_per_second[epb->interface_id];
uint64_t packet_secs = timestamp / ticks_per_sec;
uint64_t packet_secs = (ticks_per_sec != 0 ? timestamp / ticks_per_sec : 0);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also L430

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I noticed it later... I added another commit with a fix: cde15ce

@seladb
Copy link
Owner Author

seladb commented Aug 14, 2024

@tigercosmos Fuzz CI passes now 👍

It's nice to see that Fuzz CI found a bug! It was worth adding it @sashashura !!

@tigercosmos tigercosmos marked this pull request as ready for review August 14, 2024 06:06
@tigercosmos tigercosmos merged commit 0122aba into dev Aug 14, 2024
38 checks passed
@tigercosmos tigercosmos deleted the fix-light-pcapng-timestamp branch August 14, 2024 06:06
@seladb seladb mentioned this pull request Aug 14, 2024
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.

2 participants