HomePhabricator

[ubsan] Sanity-check shift amounts before truncation (fixes PR27271)

Description

[ubsan] Sanity-check shift amounts before truncation (fixes PR27271)

Ubsan does not report UB shifts in some cases where the shift exponent
needs to be truncated to match the type of the shift base. We perform a
range check on the truncated shift amount, leading to false negatives.

Fix the issue (PR27271) by performing the range check on the original
shift amount.

Differential Revision: https://reviews.llvm.org/D29234

Details

Committed
vedantkJan 27 2017, 3:02 PM
Differential Revision
D29234: [ubsan] Sanity-check shift amounts before truncation (fixes PR27271)
Branches
Unknown
Tags
Unknown