Fix a bug in #6776 discovered by @gmaxwell: -checkmempool=1 causes the internal 32-bit variable to overflow to zero.
Make -checkmempool=1 not fail through int32 overflow #6896
pull sipa wants to merge 1 commits into bitcoin:master from sipa:fixchainsize changing 1 files +1 −1-
sipa commented at 2:09 AM on October 28, 2015: member
-
Make -checkmempool=1 not fail through int32 overflow e9e616323b
-
in src/txmempool.h:None in e9e616323b
359 | @@ -360,7 +360,7 @@ class CTxMemPool 360 | * check does nothing. 361 | */ 362 | void check(const CCoinsViewCache *pcoins) const; 363 | - void setSanityCheck(double dFrequency = 1.0) { nCheckFrequency = dFrequency * 4294967296.0; } 364 | + void setSanityCheck(double dFrequency = 1.0) { nCheckFrequency = dFrequency * 4294967295.0; }
dcousens commented at 3:45 AM on October 28, 2015:Any reason not to cast explicitly?
std::static_cast<int>(dFrequency * 4294967295.0)?IMHO it might have made this more obvious to reviewers.
dcousens commented at 3:47 AM on October 28, 2015: contributorACK
laanwj commented at 9:13 AM on October 28, 2015: memberOops. Probably needs a range check, >1 and <0 will still silently overflow.
laanwj commented at 10:25 AM on October 28, 2015: memberIsn't any overflow an issue?
instagibbs commented at 2:37 PM on October 28, 2015: memberRight now it doesn't appear overflow as currently used(post-fix), but probably a good idea to internally check.
laanwj commented at 11:37 PM on October 30, 2015: memberApparently a range clamp is already done in init.cpp. That's good enough, going to merge this.
laanwj merged this on Oct 30, 2015laanwj closed this on Oct 30, 2015laanwj referenced this in commit d482c0a7b2 on Oct 30, 2015furszy referenced this in commit eb00d0f62f on Jun 14, 2020DrahtBot locked this on Sep 8, 2021
github-metadata-mirror
This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-19 09:15 UTC
This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-19 09:15 UTC
This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me
More mirrored repositories can be found on mirror.b10c.me