[Python-checkins] python/dist/src/Objects longobject.c,1.130,1.131

tim_one@users.sourceforge.net tim_one@users.sourceforge.net
Mon, 12 Aug 2002 12:43:52 -0700


Update of /cvsroot/python/python/dist/src/Objects
In directory usw-pr-cvs1:/tmp/cvs-serv1521/python/Objects

Modified Files:
	longobject.c 
Log Message:
k_mul():  Moved an assert down.  In a debug build, interrupting a
multiply via Ctrl+C could cause a NULL-pointer dereference due to
the assert.


Index: longobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/longobject.c,v
retrieving revision 1.130
retrieving revision 1.131
diff -C2 -d -r1.130 -r1.131
*** longobject.c	12 Aug 2002 19:38:01 -0000	1.130
--- longobject.c	12 Aug 2002 19:43:49 -0000	1.131
***************
*** 1723,1734 ****
  
  	t3 = k_mul(t1, t2);
- 	assert(t3->ob_size >= 0);
  	Py_DECREF(t1);
  	Py_DECREF(t2);
  	if (t3 == NULL) goto fail;
  
  	/* Add t3.  Caution:  t3 can spill one bit beyond the allocated
  	 * result space; it's t3-al*bl-ah*bh that always fits.  We have
! 	 * to arrange to ignore the hight bit.
  	 */
  	if (t3->ob_size > i) {
--- 1723,1734 ----
  
  	t3 = k_mul(t1, t2);
  	Py_DECREF(t1);
  	Py_DECREF(t2);
  	if (t3 == NULL) goto fail;
+ 	assert(t3->ob_size >= 0);
  
  	/* Add t3.  Caution:  t3 can spill one bit beyond the allocated
  	 * result space; it's t3-al*bl-ah*bh that always fits.  We have
! 	 * to arrange to ignore the high bit.
  	 */
  	if (t3->ob_size > i) {