Commit bbe72f1
lib/fonts: cjktty: Remove Unicode bidirectional control characters from comments
GCC's -Wbidi-chars option (enabled by default since GCC 12) detects
potentially dangerous Unicode bidirectional text control characters that
could be exploited in "Trojan Source" attacks (CVE-2021-42574).
The font_cjk_16x16.h/font_cjk_32x32.h header files contained actual
Unicode bidirectional control characters embedded within comments as
glyph representations:
- U+200E (LEFT-TO-RIGHT MARK)
- U+200F (RIGHT-TO-LEFT MARK)
- U+202C (POP DIRECTIONAL FORMATTING)
- U+2069 (POP DIRECTIONAL ISOLATE)
Replace these invisible control characters with their standard Unicode
abbreviations (LRM, RLM, PDF, PDI) enclosed in parentheses. This
preserves the documentary intent of the comments while eliminating the
build failure caused by -Werror=bidi-chars.
This change is necessary and appropriate because GCC 12 and later versions
introduced the -Wbidi-chars warning (enabled by default) specifically to
mitigate "Trojan Source" attacks as described in CVE-2021-42574. These
attacks exploit Unicode bidirectional override characters to make source
code appear different from how it actually executes, potentially hiding
malicious logic within seemingly benign code. While the characters in this
font header file are legitimately used as glyph data representations in
comments rather than for malicious purposes, the compiler cannot distinguish
intent and correctly flags them as a potential security risk. The kernel
build system treats all warnings as errors (-Werror), causing the build
to fail. By replacing the actual invisible control characters with their
human-readable abbreviations (LRM for Left-to-Right Mark, RLM for
Right-to-Left Mark, PDF for Pop Directional Formatting, and PDI for Pop
Directional Isolate), we maintain the original documentation purpose of
identifying which Unicode codepoint each glyph represents while ensuring
the code compiles cleanly and passes security-focused static analysis.
Link: https://www.cve.org/CVERecord?id=CVE-2021-42574
Link: https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wbidi-chars
Link: https://unicode.org/reports/tr9/
Signed-off-by: WangYuli <wangyl5933@chinaunicom.cn>
[Only fix 16x16]
(cherry picked from commit 380793f)
Signed-off-by: Wentao Guan <guanwentao@uniontech.com>1 parent 41af78e commit bbe72f1
1 file changed
Lines changed: 4 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24617 | 24617 | | |
24618 | 24618 | | |
24619 | 24619 | | |
24620 | | - | |
| 24620 | + | |
24621 | 24621 | | |
24622 | 24622 | | |
24623 | | - | |
| 24623 | + | |
24624 | 24624 | | |
24625 | 24625 | | |
24626 | 24626 | | |
| |||
24707 | 24707 | | |
24708 | 24708 | | |
24709 | 24709 | | |
24710 | | - | |
| 24710 | + | |
24711 | 24711 | | |
24712 | 24712 | | |
24713 | 24713 | | |
| |||
24890 | 24890 | | |
24891 | 24891 | | |
24892 | 24892 | | |
24893 | | - | |
| 24893 | + | |
24894 | 24894 | | |
24895 | 24895 | | |
24896 | 24896 | | |
| |||
0 commit comments