Open secure-sw-dev-bot opened 2 years ago
Comment from @dtarditi:
Hi @Machiry,
SemaBounds.cpp is also adding information about bounds for runtime checks to the AST. It wasn't designed to be called in a loop. The right thing to do is to add a flag that disables adding information to the AST for runtime bounds checks. The places in the AST where information is being attached are described in the implementation notes here.
Comment from @Machiry:
@dtarditi This is the issue for calling type checker in a loop.
This issue was copied from https://github.com/microsoft/checkedc-clang/issues/609
The checked c type checker seems to add some bounds information to certain elements of AST. For example:
ArraySubscriptExpr
. Refer: https://github.com/microsoft/checkedc-clang/blob/master/lib/Sema/SemaBounds.cpp#L1620This changes the AST and makes Sema non-reentrant. For instance, If I want to invoke CheckedC type-checker (i.e., Sema) in a loop on the same function body, specifically, the method:
It asserts out at: https://github.com/microsoft/checkedc-clang/blob/master/lib/Sema/SemaBounds.cpp#L1619 Because it already added bounds information to the expression.
To avoid this, I can remove whatever changes the type-checker had made to the AST. This way Sema doesn't assert out. Do you have any information on changes that could be done by the Checked C type checker? I see only bounds information being added to certain expression. Is this valid or there are more changes made by the type checker?