Skip to content

UTCTimeField: do not fail on out of range timestamps - #5247

Merged
gpotter2 merged 1 commit into
secdev:masterfrom
bacescuandrei:fix-utctimefield-out-of-range
Oct 24, 2026
Merged

gpotter2 merged 1 commit into
secdev:masterfrom
bacescuandrei:fix-utctimefield-out-of-range

Conversation

@bacescuandrei

@bacescuandrei bacescuandrei commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Description

UTCTimeField.i2repr() raises OverflowError: date value out of range when the timestamp is outside of the years datetime supports, so show() and sprintf() fail on such packets:

>>> from scapy.layers.ntlm import NTLMv2_CLIENT_CHALLENGE
>>> NTLMv2_CLIENT_CHALLENGE(b"\xff" * 24).show()
OverflowError: date value out of range

With this change, i2repr() returns the number of seconds alone for these values, as it does after the date for other values.

i2repr() raised OverflowError for values that datetime cannot
represent, e.g. a NTLMv2_CLIENT_CHALLENGE TimeStamp of
0xffffffffffffffff, which made show() and sprintf() fail.

AI-Assisted: yes (Claude Code, claude-opus-5-5)
@codecov

codecov Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.18%. Comparing base (bf1b540) to head (edd170c).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5247      +/-   ##
==========================================
+ Coverage   81.17%   81.18%   +0.01%     
==========================================
  Files         394      394              
  Lines       98770    98773       +3     
==========================================
+ Hits        80178    80191      +13     
+ Misses      18592    18582      -10     
Files with missing lines Coverage Δ
scapy/fields.py 92.88% <100.00%> (+0.01%) ⬆️

... and 5 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@gpotter2
gpotter2 merged commit 0a598f7 into secdev:master Oct 24, 2026
23 checks passed
@gpotter2

Copy link
Copy Markdown
Member

Thanks for the PR !

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