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

OCMock: Fix crash when running on iOS 15 device. #13

Closed

Commits on May 1, 2022

  1. OCMock: Fix crash when running on iOS 15 device.

    `object_getClass` crashes on some arguments when being run on an iOS 15
    device. `object_getClass` is needed because OCMock needs to detect if
    the argument is actually a `OCMPassByRefSetter`, which disguises as a
    pointer to an object (`id *`) but is actually an object (`id`).
    The solution is to make sure before calling `object_getClass` that the
    type encoding of the argument is actually a pointer to an object, and
    then it should be safe to call `object_getClass`.
    The problem is that the value was previously wrapped with an `NSValue`,
    which disguised the type encoding as a `void *`. Therefore the check of
    whether the argument is `id *` is done before it will be wrapped with
    `NSValue`.
    byohay committed May 1, 2022
    Configuration menu
    Copy the full SHA
    82d3537 View commit details
    Browse the repository at this point in the history