Page MenuHomePhabricator

Use size_t for stack index in OP_MULTISIG
ClosedPublic

Authored by deadalnix on Jul 11 2019, 01:26.

Details

Summary

Indices are used to index into the stack and to be compared with the stack size. Even though we don't expect the stack to a billions of elements big, it is correct to use size_t here.

Test Plan
make check
./test/functional/test_runner.py

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

deadalnix created this revision.Jul 11 2019, 01:26
Herald added a reviewer: Restricted Project. · View Herald TranscriptJul 11 2019, 01:26
markblundeberg added inline comments.
src/script/interpreter.cpp
1013 ↗(On Diff #10224)

Should k also be a size_t? I had to dig through some C++ standards to convince myself why stacktop(-isig - k) works now, when isig is size_t and k is an int...

deadalnix added inline comments.Jul 11 2019, 09:43
src/script/interpreter.cpp
1013 ↗(On Diff #10224)

No k iterate through 0 to CScriptNum, which are integers.

markblundeberg accepted this revision.Jul 13 2019, 01:53
This revision is now accepted and ready to land.Jul 13 2019, 01:53
This revision was automatically updated to reflect the committed changes.