Skip to content

Conversation

quantpoet
Copy link

Fixed some potential use-after-free bugs identified by static analysis in the core-text crate. The issues were caused by improper lifetime management of Core Foundation objects where raw pointers were being used after the underlying objects were dropped. Specifically:

In CTFontDescriptor::traits(): Eliminated intermediate CFType wrapper that was being dropped before the dictionary was returned

In create_font_descriptor() functions: Ensured CFData objects remain alive during C function calls by restructuring the unsafe block

These changes maintain the same API while ensuring memory safety through proper Core Foundation reference counting.

@quantpoet
Copy link
Author

@jdm @Taym95
Hi, Could you please review this PR at your convenience? Thank you very much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant