-
Notifications
You must be signed in to change notification settings - Fork 105
[Deepin-Kernel-SIG] [linux 6.6-y] [Deepin] fbdev: bitblit: fix bound-check glyph index in bit_putcs for cjktty #1398
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: linux-6.6.y
Are you sure you want to change the base?
Conversation
Reviewer's guide (collapsed on small PRs)Reviewer's GuideAdjusts fontdata initialization and CJK Unicode glyph indexing in fbdev bitblit font_bits() to avoid out-of-bounds access while preserving proper handling of special 0xff/0xfe glyphs. Flow diagram for updated font_bits CJK glyph handlingflowchart TD
A_start["font_bits called with vc, s, cellsize, charmask, charcnt, ops"] --> B_readch["read ch from s and apply charmask"]
B_readch --> C_initfontdata["fontdata = ops.fontbuffer if ops else vc.vc_font.data"]
C_initfontdata --> D_chk_special["is ch 0xff or 0xfe?"]
D_chk_special -- yes --> E_charcnt["is charcnt < 65536?"]
E_charcnt -- yes --> F_has_fontname["have fontname from vc? (vc_utf and vc_encoding)" ]
F_has_fontname -- yes --> G_find_font["font = find_font(fontname)"]
G_find_font --> H_set_fontdata["fontdata = font.data if font and font.data else NULL"]
F_has_fontname -- no --> I_skip_fontlookup["keep existing fontdata"]
H_set_fontdata --> J_check_fontdata["fontdata is non NULL?"]
I_skip_fontlookup --> J_check_fontdata
E_charcnt -- no --> J_check_fontdata
J_check_fontdata -- yes --> K_utfpos["c_utf = utf8_pos(vc, s)"]
K_utfpos --> L_ch_ff["is ch 0xff?"]
L_ch_ff -- yes --> M_src_ff["src = fontdata + c_utf * cellsize_utf * 2"]
L_ch_ff -- no --> N_src_fe["src = fontdata + c_utf * cellsize_utf * 2 + cellsize_utf"]
M_src_ff --> O_return_cjk["return src"]
N_src_fe --> O_return_cjk
J_check_fontdata -- no --> P_set_ch0["set ch = 0 (fallback glyph)"]
D_chk_special -- no --> Q_ch_bounds["is ch >= charcnt?"]
P_set_ch0 --> R_final_src["src = fontdata + ch * cellsize"]
Q_ch_bounds -- yes --> S_set_ch0_bounds["set ch = 0 (fallback glyph)"]
Q_ch_bounds -- no --> R_final_src
S_set_ch0_bounds --> R_final_src
R_final_src --> T_return["return src"]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
deepin pr auto review我来对这个git diff进行详细审查:
总的来说,这个改动是正面的,提高了代码的可读性和执行效率,同时保持了原有的功能完整性。建议在后续版本中可以考虑上述提到的其他改进点。 |
deepin inclusion category: bugfix charcount in cjk 16*16 and cjk 32*32 is 65536 * 2, so do this logic to map the source, c_utf = utf8_pos(vc, s); if (ch == 0xff) src = fontdata + (c_utf * cellsize_utf * 2); else src = fontdata + (c_utf * cellsize_utf * 2 + cellsize_utf); Fixes: 458d795 ("fbdev: bitblit: bound-check glyph index in bit_putcs*") Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
b067537 to
2d955ab
Compare
|
/changelog edit fixes tag |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
deepin inclusion
category: bugfix
charcount in cjk 1616 and cjk 3232 is 65536 * 2, so do this logic to map the source,
c_utf = utf8_pos(vc, s);
if (ch == 0xff)
src = fontdata + (c_utf * cellsize_utf * 2);
else
src = fontdata + (c_utf * cellsize_utf * 2 + cellsize_utf);
Fixes: 458d795 ("fbdev: bitblit: bound-check glyph index in bit_putcs*")
Summary by Sourcery
Fix font data selection and glyph index handling for UTF-8 CJK framebuffer console rendering to avoid out-of-bounds access.
Bug Fixes: