Commit 290ff5e
MarcoFalke
Merge bitcoin#24041: util: Restore GetIntArg saturating behavior
b5c9bb5 util: Restore GetIntArg saturating behavior (James O'Beirne)
Pull request description:
The new locale-independent atoi64 method introduced in bitcoin#20452 parses large integer values higher than maximum representable value as 0 instead of the maximum value, which breaks backwards compatibility. This commit restores compatibility and adds test coverage for this case in terms of the related GetIntArg and strtoll functions.
Specifically, command line or bitcoin.conf integer values greater than `9223372036854775807` (`2**63-1`) used to be parsed as `9223372036854775807` before bitcoin#20452. Then bitcoin#20452 caused them to be parsed as `0`. And after this PR they will be parsed as `9223372036854775807` again.
This change is a stripped-down alternative version of bitcoin#23841 by jamesob
ACKs for top commit:
jamesob:
Github ACK bitcoin@b5c9bb5
vincenzopalazzo:
ACK bitcoin@b5c9bb5
MarcoFalke:
review ACK b5c9bb5 🌘
Tree-SHA512: 4e8abdbabf3cf4713cf5a7c5169539159f359ab4109a4e7e644cc2e9b2b0c3c532fad9f6b772daf015e1c5340ce59280cd9a41f2730afda6099cbf636b7d23aeFile tree
5 files changed
+66
-25
lines changed- src
- test
- fuzz
- util
- test/lint
5 files changed
+66
-25
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
276 | 276 | | |
277 | 277 | | |
278 | 278 | | |
279 | | - | |
280 | 279 | | |
281 | 280 | | |
282 | | - | |
283 | | - | |
284 | | - | |
285 | | - | |
286 | | - | |
287 | | - | |
| 281 | + | |
288 | 282 | | |
289 | 283 | | |
290 | 284 | | |
291 | 285 | | |
292 | 286 | | |
293 | | - | |
| 287 | + | |
294 | 288 | | |
295 | 289 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
144 | 145 | | |
145 | 146 | | |
146 | 147 | | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
147 | 153 | | |
148 | 154 | | |
149 | 155 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
| 28 | + | |
27 | 29 | | |
28 | 30 | | |
29 | 31 | | |
| |||
1621 | 1623 | | |
1622 | 1624 | | |
1623 | 1625 | | |
| 1626 | + | |
| 1627 | + | |
| 1628 | + | |
| 1629 | + | |
| 1630 | + | |
1624 | 1631 | | |
1625 | 1632 | | |
1626 | 1633 | | |
| |||
1648 | 1655 | | |
1649 | 1656 | | |
1650 | 1657 | | |
1651 | | - | |
1652 | | - | |
| 1658 | + | |
| 1659 | + | |
1653 | 1660 | | |
1654 | | - | |
| 1661 | + | |
1655 | 1662 | | |
1656 | 1663 | | |
1657 | | - | |
| 1664 | + | |
| 1665 | + | |
| 1666 | + | |
| 1667 | + | |
| 1668 | + | |
| 1669 | + | |
| 1670 | + | |
| 1671 | + | |
| 1672 | + | |
| 1673 | + | |
| 1674 | + | |
| 1675 | + | |
| 1676 | + | |
| 1677 | + | |
| 1678 | + | |
| 1679 | + | |
| 1680 | + | |
| 1681 | + | |
| 1682 | + | |
| 1683 | + | |
| 1684 | + | |
1658 | 1685 | | |
1659 | 1686 | | |
1660 | 1687 | | |
1661 | 1688 | | |
1662 | | - | |
| 1689 | + | |
1663 | 1690 | | |
1664 | | - | |
| 1691 | + | |
1665 | 1692 | | |
1666 | 1693 | | |
1667 | | - | |
| 1694 | + | |
1668 | 1695 | | |
1669 | 1696 | | |
1670 | 1697 | | |
1671 | 1698 | | |
1672 | | - | |
| 1699 | + | |
1673 | 1700 | | |
1674 | | - | |
| 1701 | + | |
1675 | 1702 | | |
1676 | 1703 | | |
1677 | | - | |
| 1704 | + | |
1678 | 1705 | | |
1679 | 1706 | | |
1680 | 1707 | | |
1681 | 1708 | | |
1682 | | - | |
| 1709 | + | |
1683 | 1710 | | |
1684 | | - | |
| 1711 | + | |
1685 | 1712 | | |
1686 | 1713 | | |
1687 | | - | |
| 1714 | + | |
1688 | 1715 | | |
1689 | 1716 | | |
1690 | 1717 | | |
1691 | 1718 | | |
1692 | | - | |
| 1719 | + | |
1693 | 1720 | | |
1694 | 1721 | | |
1695 | 1722 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| |||
93 | 94 | | |
94 | 95 | | |
95 | 96 | | |
96 | | - | |
97 | | - | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
98 | 103 | | |
99 | 104 | | |
100 | 105 | | |
| |||
109 | 114 | | |
110 | 115 | | |
111 | 116 | | |
112 | | - | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
113 | 126 | | |
114 | 127 | | |
115 | 128 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| 46 | + | |
46 | 47 | | |
47 | 48 | | |
48 | 49 | | |
| |||
0 commit comments