OP_CHECKBLOCKATHEIGHT anti-replay (BIP 115; logic only) #10391

Open
wants to merge 5 commits into
from

Conversation

Projects
None yet
3 participants
Member

luke-jr commented May 12, 2017

No description provided.

+ }
+
+ // nHeight is a 32-bit signed integer field.
+ const int32_t nHeight = CScriptNum(stacktop(-1), true, 4).getint();
@aayanl

aayanl Jul 10, 2017

Can this cause a buffer overflow if a block height over 2147483647 occurs?

@luke-jr

luke-jr Jul 10, 2017

Member

No? Why would it?

@aayanl

aayanl Jul 10, 2017

nHeight is a int32_t, if someone makes a transaction with 2147483648 as the referenced block, it would cause an overflow

@luke-jr

luke-jr Jul 10, 2017

Member

Not all overflows are buffer overflows. In this case, CScriptNum explicitly limits the size.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment