Show More
@@ -927,8 +927,13 b' static int nt_insert(indexObject *self, ' | |||||
927 | static int nt_init(indexObject *self) |
|
927 | static int nt_init(indexObject *self) | |
928 | { |
|
928 | { | |
929 | if (self->nt == NULL) { |
|
929 | if (self->nt == NULL) { | |
|
930 | if (self->raw_length > INT_MAX) { | |||
|
931 | PyErr_SetString(PyExc_ValueError, "overflow in nt_init"); | |||
|
932 | return -1; | |||
|
933 | } | |||
930 | self->ntcapacity = self->raw_length < 4 |
|
934 | self->ntcapacity = self->raw_length < 4 | |
931 | ? 4 : self->raw_length / 2; |
|
935 | ? 4 : (int)self->raw_length / 2; | |
|
936 | ||||
932 | self->nt = calloc(self->ntcapacity, sizeof(nodetree)); |
|
937 | self->nt = calloc(self->ntcapacity, sizeof(nodetree)); | |
933 | if (self->nt == NULL) { |
|
938 | if (self->nt == NULL) { | |
934 | PyErr_NoMemory(); |
|
939 | PyErr_NoMemory(); |
General Comments 0
You need to be logged in to leave comments.
Login now