time: allow long fractions in ParseDuration
The code scanned for an integer after a decimal point, which meant things could overflow if the number was very precise (0.1234123412341234123412342134s). This fix changes the parser to stop adding precision once we run out of bits, rather than trigger an erroneous overflow. We could parse durations using floating-point arithmetic, but since the type is int64 and float64 has only has 53 bits of precision, that would be imprecise. Fixes #15011. Change-Id: If85e22b8f6cef12475e221169bb8f493bb9eb590 Reviewed-on: https://go-review.googlesource.com/29338Reviewed-by: Costin Chirvasuta <costinc@gmail.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
Showing
Please register or sign in to comment