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

Yuya Nishihara yuya at tcha.org
Wed Nov 14 07:39:50 EST 2018


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.


More information about the Mercurial-devel mailing list