[PATCH 12 of 14] sparse-revlog: introduce native (C) implementation of slicechunktodensity

Boris FELD boris.feld at octobus.net
Thu Nov 15 05:03:47 EST 2018


On 14/11/2018 13:39, Yuya Nishihara wrote:
> On Tue, 13 Nov 2018 16:35:06 +0100, Boris FELD wrote:
>>>> +	for (i = 0; i < num_revs; i++) {
>>>> +		Py_ssize_t revnum = PyInt_AsLong(PyList_GET_ITEM(list_revs, i));
>>>> +		if (revnum == -1 && PyErr_Occurred()) {
>>>> +			goto bail;
>>>> +		}
>>>> +		revs[i] = revnum;
>>>> +	}
>>> Are we sure revnum is in valid range?
>> What do you mean ?
> IOW, does the later logic makes sure that revs[i] never exceeds the length
> of the index (or other data structure)? If it doesn't, we'll have to check
> bad revnum values here and error out.
Ha yes good point. In practice they comes from a delta-chain call, but
we better make this part solid.


More information about the Mercurial-devel mailing list