fontconfig: Branch 'main' - 2 commits

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jul 30 10:33:14 UTC 2025


 fc-fontations/pattern_bindings/mod.rs |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 86b48ec01ece451d5270d0c5181a43151e45a042
Merge: 367495e 5baac4a
Author: Akira TAGOH <akira at tagoh.org>
Date:   Wed Jul 30 10:33:11 2025 +0000

    Merge branch 'dontLeakValues' into 'main'
    
    [Fontations] Don't leak PatternElement values
    
    See merge request fontconfig/fontconfig!457

commit 5baac4a7e8cdaeff38c29c0724f09135798811bd
Author: Dominik Röttsches <drott at chromium.org>
Date:   Tue Jul 29 18:30:09 2025 +0300

    [Fontations] Don't leak PatternElement values
    
    FcPatternObjectAdd(Range|CharSet|LangSet) do clone the values,
    so we need to free them on the Rust side and not leak them.
    
    However, the FcFontSetAdd() call does not clone the pattern
    that is passed in, so there, we do still need to use .into_raw().
    
    This leak was identified in a downstream Chromium ASAN
    test build when using Fontations indexing. Fix manually
    verified against this test.

diff --git a/fc-fontations/pattern_bindings/mod.rs b/fc-fontations/pattern_bindings/mod.rs
index 6bf4248..b10979e 100644
--- a/fc-fontations/pattern_bindings/mod.rs
+++ b/fc-fontations/pattern_bindings/mod.rs
@@ -127,16 +127,16 @@ impl PatternElement {
                 FcPatternObjectAddDouble(pattern, self.object_id, value)
             },
             PatternValue::Range(value) => unsafe {
-                FcPatternObjectAddRange(pattern, self.object_id, value.into_raw())
+                FcPatternObjectAddRange(pattern, self.object_id, value.as_ptr())
             },
             PatternValue::CharSet(value) => unsafe {
-                FcPatternObjectAddCharSet(pattern, self.object_id, value.into_raw())
+                FcPatternObjectAddCharSet(pattern, self.object_id, value.as_ptr())
             },
             PatternValue::LangSet(value) => unsafe {
                 FcPatternObjectAddLangSet(
                     pattern,
                     self.object_id,
-                    value.into_raw() as *const FcLangSet,
+                    value.as_ptr() as *const FcLangSet,
                 )
             },
         } == 1;


More information about the Fontconfig mailing list