Skip to content

TimeAmount.hours(.max) and probably others crash because of overflow #2532

@weissi

Description

@weissi

This may even be classified as a low severity security issue because someone may accept an hours number from a user and then do TimeAmount.hours(userProvidedValue). Not a good idea but you never know what users do.

Expected behavior

It should cap the amount to the maximum representable amount.

Actual behavior

My program crashes

Steps to reproduce

TimeAmount.hours(.max)

SwiftNIO version/commit hash

2.58.0

System & version information

macOS

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions