Skip to content
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

Fix unsoundness in new_library_with_data #309

Merged
merged 1 commit into from
May 23, 2024

Commits on Apr 23, 2024

  1. Fix unsoundness in new_library_with_data

    The `library_data` slice passed to the function that the dispatch data object is referencing does not necessarily outlive the library in which it will be contained.
    
    (Note: It _looks_ like we're upholding memory management rules here, as the object returned from `dispatch_data_create` is released with `dispatch_release` before the end of the function, but remember that the dispatch data is a reference-counted object; `MTLLibrary` will retain the dispatch data beyond the lifetime of the function).
    
    As specified in https://developer.apple.com/documentation/dispatch/1452970-dispatch_data_create, if we use DISPATCH_DATA_DESTRUCTOR_DEFAULT as the destructor block instead, `dispatch` will copy the buffer for us automatically.
    madsmtm committed Apr 23, 2024
    Configuration menu
    Copy the full SHA
    b35479e View commit details
    Browse the repository at this point in the history