[Patches] [ python-Patches-649762 ] Fix: asynchat.py: endless loop

SourceForge.net noreply@sourceforge.net
Mon, 10 Mar 2003 07:28:48 -0800


Patches item #649762, was opened at 2002-12-06 16:57
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=649762&group_id=5470

Category: Library (Lib)
Group: Python 2.2.x
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: Bernhard Reiter (ber)
Assigned to: A.M. Kuchling (akuchling)
Summary: Fix: asynchat.py: endless loop

Initial Comment:
Patch against asynchat.py revision 1.19 in Python SF CVS. 
 
Fixes endless loop when terminator='' is used. 
 
Diagnosis: 
If we do not catch the empty string no buffer will be consumed 
lin line 134 and the while loop does not terminate. 
 
Cure:  
Go back to old behaviour and call collect everything with '' and None. 
 
Background: 
Especially annoying because early versions (rev 1.1, coming with 
python1.5) 
did not have this bug and the comment in set_terminator()  
says that strings of all length are okay (among other things). 
The bug was introduced in rev 1.2. 
 
	Bernhard Reiter <bernhard@intevation.de> 

----------------------------------------------------------------------

>Comment By: A.M. Kuchling (akuchling)
Date: 2003-03-10 10:28

Message:
Logged In: YES 
user_id=11375

A fix has been checked in as rev.1.21 of asynchat.py in the CVS tree.  Thanks for your help!


----------------------------------------------------------------------

Comment By: Bernhard Reiter (ber)
Date: 2003-02-03 14:39

Message:
Logged In: YES 
user_id=113859

Yes, of course.
I stopped experimenting with numeric and empty string
terminators
after hitting this bug, so I uploaded the flawed fix.

----------------------------------------------------------------------

Comment By: A.M. Kuchling (akuchling)
Date: 2003-02-03 14:34

Message:
Logged In: YES 
user_id=11375

Surely in your patched version, the code should be 
'if not terminator: ...'.  Otherwise the patch reverses the sense of the test.


----------------------------------------------------------------------

Comment By: Bernhard Reiter (ber)
Date: 2002-12-06 17:37

Message:
Logged In: YES 
user_id=113859

The patch also fixes the terminator=0 problem 
which is similiar. 

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=649762&group_id=5470