##// END OF EJS Templates
parsers: avoid signed integer overflow in calculation of leaf-node index...
Yuya Nishihara -
r24879:b3142ea2 stable
parent child Browse files
Show More
@@ -1312,7 +1312,7 b' static int nt_find(indexObject *self, co'
1312 const char *n;
1312 const char *n;
1313 Py_ssize_t i;
1313 Py_ssize_t i;
1314
1314
1315 v = -v - 1;
1315 v = -(v + 1);
1316 n = index_node(self, v);
1316 n = index_node(self, v);
1317 if (n == NULL)
1317 if (n == NULL)
1318 return -2;
1318 return -2;
@@ -1368,7 +1368,7 b' static int nt_insert(indexObject *self, '
1368 return 0;
1368 return 0;
1369 }
1369 }
1370 if (v < 0) {
1370 if (v < 0) {
1371 const char *oldnode = index_node(self, -v - 1);
1371 const char *oldnode = index_node(self, -(v + 1));
1372 int noff;
1372 int noff;
1373
1373
1374 if (!oldnode || !memcmp(oldnode, node, 20)) {
1374 if (!oldnode || !memcmp(oldnode, node, 20)) {
General Comments 0
You need to be logged in to leave comments. Login now