HomePhabricator

Do not construct out-of-bound pointers in SHA2 code

Description

Do not construct out-of-bound pointers in SHA2 code

Summary:
This looks like an issue in the current SHA256/512 code, where a pointer outside of the area pointed to may be constructed (this is UB in theory, though in practice every supported platform treats pointers as integers).

Backport of Bitcoin Core PR15950
https://github.com/bitcoin/bitcoin/pull/15950

Test Plan:

make check

Reviewers: Fabien, #bitcoin_abc, deadalnix, jasonbcox

Reviewed By: #bitcoin_abc, jasonbcox

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

Details

Provenance
Pieter Wuille <pieter.wuille@gmail.com>Authored on May 3 2019, 23:08
fpelliccioniCommitted on Sep 11 2019, 20:31
fpelliccioniPushed on Sep 11 2019, 20:32
Reviewer
Restricted Project
Differential Revision
D4018: Do not construct out-of-bound pointers in SHA2 code
Parents
rABC4210ed4fcc0e: Avoid triggering undefined behaviour (std::memset(nullptr, 0, 0)) if an invalid…
Branches
Unknown
Tags
Unknown