C++: Consider ArrayExpr with non-constant size expressions as BufferAccesses

This commit is contained in:
Gulshan Singh
2023-04-03 23:11:05 -07:00
parent 1df3b017f2
commit 56dc2a4d4e

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.