Commit 5a73782
Fix adding small Duration to large Instant on JS and Native
When adding a positive Duration < 1 second to an Instant far in the
future for which the addition implementation overflows and throws an
exception, the catch blocks would only check if the seconds component of
the Duration is > 0. However since the Duration is < 1 second, the
seconds component is not > 0 and Instant.MIN is returned instead of
Instant.MAX.
This was fixed by replacing the check against the seconds component of
the Duration with a check against the whole Duration like it was already
done in the JVM implementation.
See #2631 parent cbbe4b2 commit 5a73782
File tree
3 files changed
+12
-3
lines changed- core
- common/test
- js/src
- native/src
3 files changed
+12
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
609 | 609 | | |
610 | 610 | | |
611 | 611 | | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
612 | 621 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | | - | |
| 38 | + | |
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
159 | 159 | | |
160 | 160 | | |
161 | 161 | | |
162 | | - | |
| 162 | + | |
163 | 163 | | |
164 | | - | |
| 164 | + | |
165 | 165 | | |
166 | 166 | | |
167 | 167 | | |
| |||
0 commit comments