Segfault in Security framework: m_AuthorizationCopyRights() wrapper

Issue #233 resolved
Vangelis Koukis
created an issue

Hello,

I'm playing with the pyobjc wrapper for the Security framework. Wrapper m_AuthorizationCopyRights() segfaults when I:

  1. Call Security.AuthorizationCopyRights() from Python, passing py_authorizedRights = None
  2. Press Cancel at the dialog box that appears.

On the other hand, passing py_authorizedRights = objc.NULL allows it complete without crashing.

It seems the crash happens at the point where the code attempts to translate back the rights returned from AuthorizationCopyRights() into a py_authorizedRights Python object, at lines 541-546, but I haven't had the chance to investigate further with a debugger yet.

Could it be that pressing Cancel leads to AuthorizationCopyRights() not setting the value of authorizedRights, declared at:

https://bitbucket.org/ronaldoussoren/pyobjc/src/3e43c546753b7c600c01022201d7a31b66e1487f/pyobjc-framework-Security/Modules/_Security.m?at=default&fileviewer=file-view-default#_Security.m-494

so the code at 541-546 accesses random memory?

Comments (3)

  1. Ronald Oussoren repo owner

    Could be. Do you have a script that demonstrates the problem?

    BTW. I think I have a fix for this issue by avoiding to access authorizedRights when the calll to AuthorizationCopyRights was not successful.

  2. Log in to comment