Open secure-sw-dev-bot opened 2 years ago
Comment from @dtarditi:
The Checked C specification does not allow this. See Section 3.6.2 of version 0.9 of the spec for the discussion. This check is not enforced by the Checked C compiler, however.
I believe the logic is there, but we turned it off because one of our early benchmark programs from the Olden benchmark site (em3d) contained local variables with bounds that are declared global variables. The fix is to turn the check back on and change the Checked C version of the benchmark program.
This issue was copied from https://github.com/microsoft/checkedc-clang/issues/1192
Checked C seems to allow the bounds of a variable
p
local to a functionf
to depend on a global variablex
. Iff
calls a function that changesx
, thenp
is not consistent with the new value ofx
, which can lead to a spatial safety violation. Example: