An integer is added to a string literal, which moves the pointer into the literal instead of appending a number

tx0/cpp:string-literal-plus-integerdefaulterrorreliability/strings-and-regexdepth fastbug

What it finds

"id: " + n is pointer arithmetic on the literal: it skips n characters and reads past the end for larger values. Building text from a number takes std::to_string, a stream or std::format.

From the rule's source, string_literal_plus_integer.rs.

Turn it on, off or suppress it

The rule runs in every tier. To turn it off for a project, set its level in tx0.toml:

tx0.toml
[rules]
"tx0/cpp:string-literal-plus-integer" = "off"

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:string-literal-plus-integer] reason="..."

tx0 explain tx0/cpp:string-literal-plus-integer shows the same in the terminal. Found a false positive? Report it.