Skip to content

Conversation

@fanquake
Copy link
Member

hebasto and others added 3 commits October 28, 2022 18:12
2147483647 is the maximum positive value of a signed int32, and - currently -
the maximum value that the deriveaddresses bitcoin RPC call accepts as
derivation index due to its input validation routines.

Before this change, when the derivation index (and thus range_end) reached
std::numeric_limits<int_32_t>::max(), the "i" variable in the for cycle (which
is declared as int, and as such 32 bits in size on most platforms) would be
incremented at the end of the first iteration and then warp back to
-2147483648. This caused SIGABRT in bitcoind and a core dump.

This change assigns "i" an explicit size of 64 bits on every platform,
sidestepping the problem.

Fixes bitcoin#26274.

Github-Pull: bitcoin#26275
Rebased-From: addf9d6
…s 2147483647

This test would cause a crash in bitcoind (see bitcoin#26274) if the fix given in the
previous commit was not applied.

Github-Pull: bitcoin#26275
Rebased-From: 9153ff3
@maflcko
Copy link
Member

maflcko commented Oct 31, 2022

cherry-pick ACK f8ed34d 🚝

Show signature

Signature:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

cherry-pick ACK f8ed34d1a9faf373b96842c26a408b039bcdfc51  🚝
-----BEGIN PGP SIGNATURE-----

iQGzBAEBCgAdFiEE+rVPoUahrI9sLGYTzit1aX5ppUgFAlwqrYAACgkQzit1aX5p
pUh4fQv/fqqWkBogNFKJx+rm5sISNZhhvUVNaTh5PLT/JvCQciZvs2AHroVv5WLm
N4RgaZjZuLaBCIlZlhi+ROJpAP3NaaCK32UFSyO46iQovjOCWoPvxAkB/Dua/hLO
xwjsCST59odgr34mfO89zmdMSDZwYJ0tqqfqzO/kKRhnCvswwjyAhqqQk0rhD3ys
nGuqYHuv4Ahucu8H/HxIRXCWVVJbkAyIaruJKcj5rogUCHIF2f3dfDJYfP4rgYjm
ILyZByeOJKZXtdmm9X0cDsnShZX9Fa/XffXM60iGJ0DockxBKVCgbgq6V3XnbgD+
hppcslBAXz8ueFWVqIDRL1H3xmTg+Ifcm7l3dU4e+1Wm5Fd7CYHb9L9kwdZdEcvs
oRR9wqO/ARCYOhoIIK4vhcvAUYt61lubdkagI8kZy3tzFty7yKt5yYOY8IsFpYMS
1GauIXM0Of7hTyjpBCX1Ml4ApbvyyRzngOliUN779cQW3WphYGq05aE+0RQyxNXJ
EghuCkBD
=egea
-----END PGP SIGNATURE-----

@maflcko maflcko merged commit 65c2f78 into bitcoin:23.x Oct 31, 2022
@fanquake fanquake deleted the 23_1_backports branch October 31, 2022 16:01
delta1 added a commit to delta1/elements that referenced this pull request Sep 24, 2023
@bitcoin bitcoin locked and limited conversation to collaborators Oct 31, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants