Page MenuHomePhabricator

Merge #9693: Prevent integer overflow in ReadVarInt.
ClosedPublic

Authored by nakihito on May 6 2019, 23:46.

Details

Summary

45f0961 Prevent integer overflow in ReadVarInt. (Gregory Maxwell)

Tree-SHA512: 385ea0efb6b59d44c45a49227e5f6fff236b4775544cbeb236312a3fd87fd75c226ac56f7aa1bca66b853639da75a579610074f7582f92cf2ebd4a74bc40f6f0

Backport of Core PR 9693
https://github.com/bitcoin/bitcoin/pull/9693/

Test Plan

make check

Diff Detail

Repository
rABC Bitcoin ABC
Branch
PR9693
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 5708
Build 9478: Bitcoin ABC Buildbot (legacy)
Build 9477: arc lint + arc unit

Event Timeline

Owners added a reviewer: Restricted Owners Package.May 6 2019, 23:46
jasonbcox requested changes to this revision.May 7 2019, 00:13
jasonbcox added inline comments.
src/serialize.h
377

The else is unnecessary since all callpaths past the if-check apply to the same condition. It's a minor code-style difference, but introducing else clauses where they are unnecessary forces decision making later on (when the code may have become more complex).

Contrived example:

if (blah) {
  // stuff
}
// other stuff
// * new stuff goes here unless it explicitly relates to *blah*
if (blah) {
  // stuff
} else {
  // other stuff
  // * add new stuff here?
}
// * or here?
This revision now requires changes to proceed.May 7 2019, 00:13
This revision is now accepted and ready to land.May 7 2019, 00:33
This revision was automatically updated to reflect the committed changes.