Show More
@@ -1166,7 +1166,9 b' static PyObject *reachableroots(indexObj' | |||||
1166 | /* Populate tovisit with all the heads */ |
|
1166 | /* Populate tovisit with all the heads */ | |
1167 | numheads = PyList_GET_SIZE(heads); |
|
1167 | numheads = PyList_GET_SIZE(heads); | |
1168 | for (i = 0; i < numheads; i++) { |
|
1168 | for (i = 0; i < numheads; i++) { | |
1169 |
revnum = PyInt_A |
|
1169 | revnum = PyInt_AsLong(PyList_GET_ITEM(heads, i)); | |
|
1170 | if (revnum == -1 && PyErr_Occurred()) | |||
|
1171 | goto bail; | |||
1170 | if (revnum + 1 < 0 || revnum + 1 >= len + 1) { |
|
1172 | if (revnum + 1 < 0 || revnum + 1 >= len + 1) { | |
1171 | PyErr_SetString(PyExc_IndexError, "head out of range"); |
|
1173 | PyErr_SetString(PyExc_IndexError, "head out of range"); | |
1172 | goto bail; |
|
1174 | goto bail; |
@@ -73,12 +73,12 b' Test SEGV caused by bad revision passed ' | |||||
73 | > for head in [0, len(cl) - 1, -1]: |
|
73 | > for head in [0, len(cl) - 1, -1]: | |
74 | > print'%s: %r' % (head, cl.reachableroots(0, [head], set([0]))) |
|
74 | > print'%s: %r' % (head, cl.reachableroots(0, [head], set([0]))) | |
75 | > print 'bads:' |
|
75 | > print 'bads:' | |
76 | > for head in [len(cl), 10000, -2, -10000]: |
|
76 | > for head in [len(cl), 10000, -2, -10000, None]: | |
77 | > print '%s:' % head, |
|
77 | > print '%s:' % head, | |
78 | > try: |
|
78 | > try: | |
79 | > cl.reachableroots(0, [head], set([0])) |
|
79 | > cl.reachableroots(0, [head], set([0])) | |
80 | > print 'uncaught buffer overflow?' |
|
80 | > print 'uncaught buffer overflow?' | |
81 | > except IndexError as inst: |
|
81 | > except (IndexError, TypeError) as inst: | |
82 | > print inst |
|
82 | > print inst | |
83 | > EOF |
|
83 | > EOF | |
84 | goods: |
|
84 | goods: | |
@@ -90,6 +90,7 b' Test SEGV caused by bad revision passed ' | |||||
90 | 10000: head out of range |
|
90 | 10000: head out of range | |
91 | -2: head out of range |
|
91 | -2: head out of range | |
92 | -10000: head out of range |
|
92 | -10000: head out of range | |
|
93 | None: an integer is required | |||
93 |
|
94 | |||
94 | $ cd .. |
|
95 | $ cd .. | |
95 |
|
96 |
General Comments 0
You need to be logged in to leave comments.
Login now