encoding_c icon indicating copy to clipboard operation
encoding_c copied to clipboard

Missing null checks and panic handlers in extern functions

Open marco-vassena opened this issue 1 year ago • 0 comments

The FFI bindings in this library are missing null checks and panic handlers that would avoid undefined behavior. The documentation does warn users about conditions that will trigger undefined behavior, but the library could provide a safer interface by avoiding those sources of undefined behavior.

In particular, the bindings could:

  1. Use is_null to check that pointers are not null before accessing them
  2. Use catch_unwind to stop panics from unwinding across the FFI

marco-vassena avatar Oct 31 '23 15:10 marco-vassena