This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: SSL crash interpreter on error
Type: Stage:
Components: Extension Modules Versions: Python 2.3
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: nnorwitz Nosy List: lemburg, nnorwitz
Priority: high Keywords: patch

Created on 2003-06-15 13:26 by nnorwitz, last changed 2022-04-10 16:09 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
ssl.diff nnorwitz, 2003-06-15 13:26 fix attempt 1
Messages (4)
msg43990 - (view) Author: Neal Norwitz (nnorwitz) * (Python committer) Date: 2003-06-15 13:26
When testing bug 739909, I provoked this bug.  To
reproduce:

  # ./python # need to be root to listen on privileged port
  >>> from socket import *
  >>> s = socket(AF_INET, SOCK_STREAM)
  >>> s.bind(('', 993))
  >>> s.listen(5)
  >>> s.accept()

  # now go to another window and do:

  $ ./python
  >>> import imaplib
  >>> imaplib.IMAP4_SSL('localhost')

  # this will wait for the first (root) interpreter
  # exit from first/root interpreter and SSL will crash

There is a stack trace below.

The problem is that in PySSL_SetError(), there is an
assumption that obj->Socket exists, but it doesn't in
this case.

The attached patch  fixes the crash, but I'm not
certain it is correct.

#0  0x4046eaba in PySSL_SetError (obj=0x81e0718, ret=-1)
    at /home/neal/build/python/2_3/Modules/_ssl.c:118
#1  0x4046efed in newPySSLObject (Sock=0x4013f9c8,
key_file=0x0, cert_file=0x0)
    at /home/neal/build/python/2_3/Modules/_ssl.c:259
#2  0x4046f181 in PySocket_ssl (self=0x0, args=0x403e4df4)
    at /home/neal/build/python/2_3/Modules/_ssl.c:296
msg43991 - (view) Author: Marc-Andre Lemburg (lemburg) * (Python committer) Date: 2003-06-15 19:26
Logged In: YES 
user_id=38388

Sorry, no time for this.
msg43992 - (view) Author: Neal Norwitz (nnorwitz) * (Python committer) Date: 2003-06-16 13:31
Logged In: YES 
user_id=33168

Moved to patches
msg43993 - (view) Author: Neal Norwitz (nnorwitz) * (Python committer) Date: 2003-06-30 03:25
Logged In: YES 
user_id=33168

Checked in a modified version of the patch as: 
 * Modules/_ssl.c 1.13
 * Lib/test/test_socket_ssl.py 1.7

I can't see any negative consequences of this patch and it
fixes a crash.
History
Date User Action Args
2022-04-10 16:09:14adminsetgithub: 38652
2003-06-15 13:26:46nnorwitzcreate