Skip to content

Commit 2a25cbd

Browse files
06kellyjacthomasnyman
authored andcommitted
Extend clang-tidy notes related to trojan source lints
Signed-off-by: Jack Kelly <[email protected]>
1 parent cc3f225 commit 2a25cbd

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

docs/Compiler-Hardening-Guides/Compiler-Options-Hardening-Guide-for-C-and-C++.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,9 +379,15 @@ Do *not* use `-Wbidi-chars=any` or `-Wbidi-chars=any,ucn` in cases where some of
379379

380380
It is best to use other static code analysis tools to also warn about Trojan Source, since it's not an issue developers typically consider. Some editors have mechanisms to warn about Trojan Source; using them is recommended where practical. However, it's sometimes difficult to verify whether developers and reviewers have used such tools.
381381

382-
clang-tidy's `misc-misleading-bidirectional` check warns about unterminated bidirectional Unicode sequences, similar to GCC's `-Wbidi-chars=unpaired`[^clang-tidy-bidi].
382+
`clang-tidy` has multiple lints to help identify Trojan Source:
383+
384+
- `misc-misleading-bidirectional` check warns about unterminated bidirectional Unicode sequences, similar to GCC's `-Wbidi-chars=unpaired`[^clang-tidy-bidi].
385+
- `misc-confusable-identifiers` check warns about characters that are visually similar [^clang-tidy-confusable].
386+
- `misc-misleading-identifier` check warns about bidirectional Unicode that can change the meaning of the code [^clang-tidy-misleading].
383387

384388
[^clang-tidy-bidi]: LLVM team, [clang-tidy - misc-misleading-bidirectional](https://clang.llvm.org/extra/clang-tidy/checks/misc/misleading-bidirectional.html), Extra Clang Tools Documentation, 2024-03-28.
389+
[^clang-tidy-confusable]: LLVM team, [clang-tidy - misc-confusable-identifiers](https://clang.llvm.org/extra/clang-tidy/checks/misc/confusable-identifiers.html), Extra Clang Tools Documentation, 2024-03-28.
390+
[^clang-tidy-misleading]: LLVM team, [clang-tidy - misc-misleading-identifier](https://clang.llvm.org/extra/clang-tidy/checks/misc/misleading-identifier.html), Extra Clang Tools Documentation, 2024-03-28.
385391

386392
---
387393

0 commit comments

Comments
 (0)