This is an archive of the discontinued LLVM Phabricator instance.

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

Authored by vsk on Jan 27 2017, 2:47 PM.

Details

Summary

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.

Diff Detail

Repository
rL LLVM

Event Timeline

vsk created this revision.Jan 27 2017, 2:47 PM
rsmith accepted this revision.Jan 27 2017, 3:07 PM
This revision is now accepted and ready to land.Jan 27 2017, 3:07 PM
This revision was automatically updated to reflect the committed changes.