HomePhabricator

[StackProtector] Catch direct out-of-bounds when checking address-takenness

Authored by john.brawn on Mar 5 2020, 9:18 AM.

Description

[StackProtector] Catch direct out-of-bounds when checking address-takenness

With -fstack-protector-strong we check if a non-array variable has its address
taken in a way that could cause a potential out-of-bounds access. However what
we don't catch is when the address is directly used to create an out-of-bounds
memory access.

Fix this by examining the offsets of GEPs that are ultimately derived from
allocas and checking if the resulting address is out-of-bounds, and by checking
that any memory operations using such addresses are not over-large.

Fixes PR43478.

Differential revision: https://reviews.llvm.org/D75695