Skip to content

Review safety in low-level code #5

@Bromeon

Description

@Bromeon

The current low-level implementation has some rough edges, such as unnecessary unsafe or possible UB. This issue tracks several code locations, in which robustness could be improved. A lot of those are marked with TODO or FIXME in code.

Soundness:

  • Global access to everything uses static mut
  • Global string registry (returning *const i8) hands out &mut at will
    • This was removed a long time ago, as I found out we don't need to retain the memory on our side.
  • as_storage() not only hands out &mut, but also leaves them unbounded

Test coverage:

  • Ptrcalls and pointer conversions
  • Varcalls and variant conversions
  • Reference-counter increments and decrements across several types
  • Deref and cast between smart pointers/references to Godot objects
  • Memory leak checks (mem::forget, missing dec_ref, etc.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugc: ffiLow-level components and interaction with GDExtension APIubUndefined behavior

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions