HomePhabricator

Prevent ints from wrapping around in scratch space functions

Description

Prevent ints from wrapping around in scratch space functions

Summary:

  • Add check preventing integer multiplication wrapping around in scratch_max_allocation
  • Add check preventing rounding to alignment from wrapping around in scratch_alloc
  • Use ROUND_TO_ALIGN in scratch_create
  • Don't assume that ALIGNMENT > 1 in tests

This is a backport of secp256k1 PR648

Test Plan:

ninja check-secp256k1

Reviewers: #bitcoin_abc, jasonbcox

Reviewed By: #bitcoin_abc, jasonbcox

Differential Revision: https://reviews.bitcoinabc.org/D7608

Details

Provenance
Jonas Nick <jonasd.nick@gmail.com>Authored on Jul 12 2019, 09:56
deadalnixCommitted on Sep 28 2020, 16:38
deadalnixPushed on Sep 28 2020, 16:38
Reviewer
Restricted Project
Differential Revision
D7608: Prevent ints from wrapping around in scratch space functions
Parents
rABC147e8bd648d4: Remove the extremely outdated TODO file.
Branches
Unknown
Tags
Unknown