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

refactor(ffi): check pointer arguments for NULL #2624

Merged
merged 1 commit into from Aug 18, 2021
Merged

Commits on Aug 18, 2021

  1. refactor(ffi): check pointer arguments for NULL

    This changes all the extern C functions in `hyper::ffi` to check passed
    pointer arguments for being `NULL` before trying to use them. Before, we
    would just assume the programmer had passed a good pointer, which could
    result in segmentation faults. Now:
    
    - In debug builds, it will assert they aren't null, and so if they are,
      a message identifying the argument name will be printed and then the
      process will crash.
    - In release builds, it will still check for null, but if found, it will
      return early, with a return value indicating failure if the return type
      allows (such as returning NULL, or `HYPERE_INVALID_ARG`).
    seanmonstar committed Aug 18, 2021
    Copy the full SHA
    d8d7f04 View commit details
    Browse the repository at this point in the history