about summary refs log tree commit diff
path: root/src/libsyntax/parse
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2017-09-10 18:37:27 +0000
committerbors <bors@rust-lang.org>2017-09-10 18:37:27 +0000
commitca94c75c527006be0824c764773380bbeea6030b (patch)
tree947a43561b8045589fdc9f3c13cbadbf4e5ca0bb /src/libsyntax/parse
parentb413f34087d913b80cf432a66d05ec5be11f3515 (diff)
parent4962f9d72528602f70c7017d95063ef93a3c8967 (diff)
downloadrust-ca94c75c527006be0824c764773380bbeea6030b.tar.gz
rust-ca94c75c527006be0824c764773380bbeea6030b.zip
Auto merge of #44220 - kennytm:fix-44216-instance-plus-max-duration-should-panic, r=alexcrichton
Properly detect overflow in Instance ± Duration.

Fix #44216.
Fix #42622

The computation `Instant::now() + Duration::from_secs(u64::max_value())` now panics. The call `receiver.recv_timeout(Duration::from_secs(u64::max_value()))`, which involves such time addition, will also panic.

The reason #44216 arises is because of an unchecked cast from `u64` to `i64`, making the duration equivalent to -1 second.

Note that the current implementation is over-conservative, since e.g. (-2⁶²) + (2⁶³) is perfectly fine for an `i64`, yet this is rejected because (2⁶³) overflows the `i64`.
Diffstat (limited to 'src/libsyntax/parse')
0 files changed, 0 insertions, 0 deletions