Skip to content

Crashing in il2cpp_image_get_name in marshaling on macOS .NET 8.0 #223

@slick1015

Description

@slick1015

After PR #220 I am crashing on calls to il2cpp_image_get_name. The runtime is calling free() on the returned pointer, which is invalid because all pointers returned by il2cpp_image_get_name are pointers into the middle of global-metadata.dat. This is in a .NET 8.0 runtime. I believe this is because marshaling is expecting that when a char* is returned and marshaled to a string it was heap/malloc() allocated and needs to be freed after being converted into a managed string.

I think all of the string related marshaling in IL2CPP.cs should be reconsidered since the il2cpp_* API is generally not returning heap/malloc() allocated strings.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions