[Python-checkins] python/dist/src/Objects listobject.c,2.108,2.109 sliceobject.c,2.12,2.13 stringobject.c,2.165,2.166 tupleobject.c,2.64,2.65 unicodeobject.c,2.151,2.152

Michael Hudson mwh@python.net
Tue, 11 Jun 2002 14:33:42 +0100 (BST)


On Tue, 11 Jun 2002, Neal Norwitz wrote:

> Michael:
> 
> There is a problem with the patch below.
> I think it is a general problem (for all types).
> I verified w/lists only.  I'll describe the problem inline below.
> 
> >>> n = [1, 2, 3]
> >>> n[10000:30000:2]
> Segmentation fault (core dumped)

Ouch!

[...]

> Here is where the problem is.  You are referencing self list
> with cur, but cur is not guaranteed to be < list length.
> I think all you have to do is add another condition to the for loop
>  && cur < PyList_Length(self) (or should that be PyList_Size(self)?).

No, PySlice_GetIndicesEx was wrong.  It was returning a slicelength of 1 
when it should have been 0.  Fix imminent.

Cheers,
M.