Repository navigation
fix(libfontconfig): read FreeType face and charmap through guest memory - #22685
oneandonlydean merged 1 commit into
Conversation
PrivacyOnion
left a comment
There was a problem hiding this comment.
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against 43c8cf2d92:
- Conventions:
tools/check_conventions.pypassed. - Build:
guest_fontconfig_char_index_testsbuilt cleanly. - CTest (
guest_fontconfig_char_index):1/1 Test #5258: guest_fontconfig_char_index ...... Passed 0.01 sec 100% tests passed, 0 tests failed out of 1 - Negative control: with
core/libs/prx/libfontconfig/Export.cppreverted tomainand the new tests kept, the suite fails:Restoring the change makes it pass again.1/1 Test #5258: guest_fontconfig_char_index ......***Exception: SegFault 0.12 sec 0% tests passed, 1 tests failed out of 1 - Code reading:
- Verified that FcFreeTypeCharIndex in Export.cpp safely accesses face->charmap and charmap->encoding using CopyGuestIn (GuestCopyIn_nid_no_patch) via ReadCharmapEncoding, returning 0 on invalid/unmapped guest memory.
- Verified that ReadCharmapEncoding properly handles face->charmap == nullptr, setting encoding to 0 and hasCharmap to false without attempting to dereference null.
- Verified loop logic in FcFreeTypeCharIndex over FT_ENCODING_UNICODE and FT_ENCODING_MS_SYMBOL, ensuring charmap re-query via ReadCharmapEncoding accurately inspects current encoding after FT_Select_Charmap_nid_postfix.
- Verified AGENTS.md compliance: no comments in source code, technical debt fragment created under docs/dev/debt/changes/, no extra unauthorized files added.
- Verified test coverage in GuestFontconfigCharIndex.cpp: assertions check null face, unmapped face pointer (0x10), and face with an unmapped charmap pointer (0x10).
Looks Good To Me
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed — looks good
Nothing in the inspected changes shows a blocking defect; the changed source and test support the stated guest memory safety fix.
What I ran
- Reviewed head
43c8cf2d92c512ec15734f3dc67fcb418e396515usingrepo_read.py. - Read the prepared description, commit summary, diff, manifest, and all three changed files. No tests or prechecks were run.
Results
| Check | Result | Note |
|---|---|---|
| Source review | passed | All changed files read |
| Tests and prechecks | not run | Author reports checks in the PR description |
Findings
Blocking
None.
Non-blocking
None.
Not verified
- Did not run
GuestFontconfigCharIndex, conventions, guest pointer audit, or PR overlap checks; those runs are author-reported only. - Console Fontconfig version, call signature, and behavior are stated as unmeasured in the added debt note.
- No excluded changed files were listed in the manifest;
files.jsonwas not available through the reader.
To get this to a good state
Nothing is required.
|
Tested
AI-assisted: yes (Claude Code); the runs are automated, this summary was written from their reports. |
|
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
|
Manually checked PR 17631 ( |
|
Tested head Setup: Windows 11 Pro 10.0.26200, Ryzen 7 9800X3D, WinLibs GCC 15.2.0 r7, Release,
Whole batch: the full This is one combined tree, not a run of this PR alone. AI-assisted: yes (Claude Code) |
What
FcFreeTypeCharIndexinlibfontconfigdereferencedface->charmapandcharmap->encodingdirectly on the host, causing a segmentation fault or memory access violation when passed an unmapped guest face pointer or a face containing an unreadable charmap pointer. Read both fields safely throughCopyGuestIn(GuestCopyIn_nid_no_patch), returning 0 if memory cannot be read. Update unit testGuestFontconfigCharIndexwith unmapped face and charmap pointer checks, and fold the technical debt notes.Tested
python tools/check_conventions.py --base upstream/main: All conventions checks passed.python tools/guest_pointer_audit.py libfontconfig: The finding onFcFreeTypeCharIndex: parameter face (member)is eliminated (total findings reduced from 23 to 22).python tools/pr_overlap.py --names FcFreeTypeCharIndex: Confirmedopen: noneacross all open pull requests.GuestFontconfigCharIndex: Added regressions verifyingFcFreeTypeCharIndexreturns 0 when passed an unmapped face pointer (0x10) or a face with an unmapped charmap pointer.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)