Memory Leak in Security framework with TLS handshake process

Originator:r.amrutakrishna
Number:rdar://20435142 Date Originated:04/06/2015
Status:Open Resolved:
Product:iOS SDK Product Version:8.1
Classification:Other Reproducible:Every time
 
Summary:
While performing the TLS handshake, we found a memory leak in sslGetPubKeyFromBits function. This function is part of iOS Security framework. I've attached the stack trace of the leak and also the image showing the retain count of leaked object

Stack Trace of the leak:

   0 libsystem_malloc.dylib malloc_zone_malloc
   1 libsystem_malloc.dylib malloc
   2 libsystem_coretls.dylib sslGetPubKeyFromBits
   3 libsystem_coretls.dylib tls_handshake_set_peer_rsa_public_key
   4 Security tls_verify_peer_cert
   5 libsystem_coretls.dylib SSLProcessHandshakeRecordInner
   6 libsystem_coretls.dylib SSLProcessHandshakeRecord
   7 libsystem_coretls.dylib tls_handshake_process
   8 Security SSLHandshakeProceed
   9 Security SSLHandshake
  10 CFNetwork SocketStream::_PerformSecurityHandshake_NoLock()
  11 CFNetwork SocketStream::socketCallbackReadLocked(SocketStreamSignalHolder*)
  12 CFNetwork SocketStream::socketCallback(__CFSocket*, unsigned long, __CFData const*, void const*)
  13 CFNetwork SocketStream::_SocketCallBack_stream(__CFSocket*, unsigned long, __CFData const*, void const*, void*)
  14 CoreFoundation __CFSocketPerformV0
  15 CoreFoundation __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__
  16 CoreFoundation __CFRunLoopDoSources0
  17 CoreFoundation __CFRunLoopRun
  18 CoreFoundation CFRunLoopRunSpecific
  19 CoreFoundation CFRunLoopRunInMode
  20 CFNetwork +[NSURLConnection(Loader) _resourceLoadLoop:]
  21 Foundation -[NSThread main]
  22 Foundation __NSThread__main__
  23 libsystem_pthread.dylib _pthread_body
  24 libsystem_pthread.dylib _pthread_start
  25 libsystem_pthread.dylib thread_start

Expected Results:
Memory leak shouldn't occur in TLS handshake process

Actual Results:
Memory leak exists in TLS handshake process

Version:
iOS 8.1

Notes:
This can be reproduced every time

Configuration:
iPhone (8.1 supported versions), iPad (8.1 supported versions)

Attachments:
'Screen Shot 2015-04-06 at 12.34.08 PM.png' was successfully uploaded.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!