Skip to content

wire: Clamp max allowed timestamp values.#3615

Merged
davecgh merged 2 commits intodecred:masterfrom
davecgh:wire_addrv2_max_timestamps
Feb 25, 2026
Merged

wire: Clamp max allowed timestamp values.#3615
davecgh merged 2 commits intodecred:masterfrom
davecgh:wire_addrv2_max_timestamps

Conversation

@davecgh
Copy link
Copy Markdown
Member

@davecgh davecgh commented Feb 17, 2026

This modifies the code that deals with serializing and deserializing the newly added addrv2 netaddress timestamps uint64s to be more restrictive and reject any values that result in times that require special handling for comparisons. While here, it also does the same for int64 timestamps even though those cases are already handled otherwise.

This clamping behavior is not strictly required since code that deals with the timestamps later is careful to avoid bad timestamps in general, but it safer to just reject them at the protocol level so even if code elsewhere is not taking extra precautions there still not be any potential issues.

@davecgh davecgh added this to the 2.2.0 milestone Feb 17, 2026
@davecgh davecgh changed the title wire: Clamp max allow timestamp values. wire: Clamp max allowed timestamp values. Feb 17, 2026
@davecgh davecgh force-pushed the wire_addrv2_max_timestamps branch from a26048f to cb9f6e9 Compare February 17, 2026 11:29
@davecgh davecgh force-pushed the wire_addrv2_max_timestamps branch from cb9f6e9 to dc40cad Compare February 18, 2026 18:08
@davecgh davecgh force-pushed the wire_addrv2_max_timestamps branch from dc40cad to 80bb930 Compare February 23, 2026 10:13
This adds a couple of tests to ensure a couple of the newer error codes
produce the expected human-readable output that were missed when adding
them.

It also adds a new define to the enum to count how many there are along
with a test to detect missing entries.
This modifies the code that deals with serializing and deserializing the
newly added addrv2 netaddress timestamps uint64s to be more restrictive
and reject any values that result in times that require special handling
for comparisons.  While here, it also does the same for int64
timestamps even though those cases are already handled otherwise.

This clamping behavior is not strictly required since code that deals
with the timestamps later is careful to avoid bad timestamps in general,
but it safer to just reject them at the protocol level so even if code
elsewhere is not taking extra precautions there would still not be any
potential issues.
@davecgh davecgh force-pushed the wire_addrv2_max_timestamps branch from 80bb930 to af4aaac Compare February 25, 2026 05:10
@davecgh davecgh merged commit af4aaac into decred:master Feb 25, 2026
33 checks passed
@davecgh davecgh deleted the wire_addrv2_max_timestamps branch February 25, 2026 05:13
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.

3 participants