[Python-checkins] python/dist/src/Objects typeobject.c,2.199,2.200

gvanrossum@users.sourceforge.net gvanrossum@users.sourceforge.net
Tue, 31 Dec 2002 08:33:05 -0800


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

Modified Files:
	typeobject.c 
Log Message:
Fix an out-of-bound index in pmerge() discovered by Zooko (SF bug
645404).  I'm not 100% sure this is the right fix, so I'll keep the
bug report open for Samuele, but this fixes the index error and passes
the test suite (and I can't see why it *shouldn't* be the right fix
:-).


Index: typeobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v
retrieving revision 2.199
retrieving revision 2.200
diff -C2 -d -r2.199 -r2.200
*** typeobject.c	14 Dec 2002 17:17:56 -0000	2.199
--- typeobject.c	31 Dec 2002 16:33:01 -0000	2.200
***************
*** 1068,1072 ****
  		for (j = 0; j < to_merge_size; j++) {
  			PyObject *j_lst = PyList_GET_ITEM(to_merge, j);
! 			if (PyList_GET_ITEM(j_lst, remain[j]) == candidate) {
  				remain[j]++;
  			}
--- 1068,1073 ----
  		for (j = 0; j < to_merge_size; j++) {
  			PyObject *j_lst = PyList_GET_ITEM(to_merge, j);
! 			if (remain[j] < PyList_GET_SIZE(j_lst) &&
! 			    PyList_GET_ITEM(j_lst, remain[j]) == candidate) {
  				remain[j]++;
  			}