Describe the issue
Date.encode method crashes if the date is long distant future
Vapor version
4.111.1
Operating system and version
macOS 26.3.1
Swift version
6.2.3
Steps to reproduce
No response
Outcome
No response
Additional notes
|
let seconds = self.timeIntervalSince(Self._psqlDateStart) * Double(Self._microsecondsPerSecond) |
|
byteBuffer.writeInteger(Int64(seconds)) |
Date.encode internally computes its seconds from _psqlDateStart and convert it to Int64.
If the seconds is greater than Int64.max, this method crashes.
Fatal error: Double value cannot be converted to Int64 because the result would be greater than Int64.max
Describe the issue
Date.encodemethod crashes if the date is long distant futureVapor version
4.111.1
Operating system and version
macOS 26.3.1
Swift version
6.2.3
Steps to reproduce
No response
Outcome
No response
Additional notes
postgres-nio/Sources/PostgresNIO/New/Data/Date+PostgresCodable.swift
Lines 18 to 19 in cc0201c
Date.encodeinternally computes itssecondsfrom_psqlDateStartand convert it toInt64.If the
secondsis greater thanInt64.max, this method crashes.