Merge pull request #12752 from gsingh93/buffer-access-array-expr

C++: Consider ArrayExpr with non-constant size expressions as a BufferAccess
This commit is contained in:
Geoffrey White
2023-04-14 15:31:20 +01:00
committed by GitHub

View File

@@ -314,9 +314,8 @@ class FreadBA extends BufferAccess {
* but not:
* &buffer[ix]
*/
class ArrayExprBA extends BufferAccess {
class ArrayExprBA extends BufferAccess, ArrayExpr {
ArrayExprBA() {
exists(this.(ArrayExpr).getArrayOffset().getValue().toInt()) and
not exists(AddressOfExpr aoe | aoe.getAChild() = this) and
// exclude accesses in macro implementation of `strcmp`,
// which are carefully controlled but can look dangerous.