Skip to content

Reduce use-after-free risk for UserEvents, Notifiers, etc #37

@jkneer

Description

@jkneer

Just coming back from hunting down a use-after-free bug in my code caused by UserEvents.

In summary: Some elements, i.e. notifiers, UserEvents, queues... allow the user to free the memory/reference in LabVIEW. At the same time these are things that one probably holds on for longer than just a single function call.

All I did in my code was release the UserEvent in LV right before the DLL call to my library. In the meantime my lib tried to send some UserEvents and crashed.

Idea:

  1. Test if the memory manager functions to check handles and ptrs (DSCheckHandle, DSCheckPtr) also work for the references of these elements.
  2. If that is possible we could implement a safe wrapper around the respective functionality. Maybe hidden behind a config option to disable this safety feature if the performance penalty may be unacceptable for some use cases.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions