Skip to content

Fix uint16 overflow warning in source sequence counter gap check - #3573

Open
SAY-5 wants to merge 1 commit into
IMAP-Science-Operations-Center:devfrom
SAY-5:fix-src-seq-ctr-overflow
Open

SAY-5 wants to merge 1 commit into
IMAP-Science-Operations-Center:devfrom
SAY-5:fix-src-seq-ctr-overflow

Conversation

@SAY-5

@SAY-5 SAY-5 commented Oct 18, 2026

Copy link
Copy Markdown

Change Summary

Overview

The source sequence counter comes out of packet parsing as an unsigned integer, so the gap subtraction in _check_source_sequence_counter wraps and emits RuntimeWarning: overflow encountered in scalar subtract whenever the counter rolls over, as seen in the SWAPI logs. Casting the counter to int32 before the arithmetic removes the warning and keeps the missing packet count the same.

File changes

imap_processing/utils.py: cast src_seq_ctr to int32 in _check_source_sequence_counter.

Testing

Added test_check_source_sequence_counter_unsigned_rollover, which uses a uint16 counter with a rollover gap and fails on the RuntimeWarning without the change.

Closes #3436

Signed-off-by: Sai Asish Y <say.apm35@gmail.com>

This branch has not been deployed

No deployments
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.

BUG - overflow in subtraction when computing missing packets

1 participant