A local array has a length that is only known at run time, which standard C++ does not allow

tx0/cpp:variable-length-arrayrecommendedwarningsecurity/denial-of-servicedepth fastbug, cwe-770

What it finds

Arrays whose length is a variable are a C feature that GCC and Clang accept in C++ as an extension. A large or negative length overflows the stack without any error, and other compilers reject the code. std::vector sizes at run time on the heap.

From the rule's source, variable_length_array.rs.

Turn it on, off or suppress it

The rule runs from the recommended tier up. To turn it on in a lower tier, give it a level in tx0.toml:

tx0.toml
[rules]
"tx0/cpp:variable-length-array" = "warning"

To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:

// tx0: ignore[tx0/cpp:variable-length-array] reason="..."

tx0 explain tx0/cpp:variable-length-array shows the same in the terminal. Found a false positive? Report it.