##// END OF EJS Templates
dirstate: use tuple interface to fix leak in pack_dirstate()...
Yuya Nishihara -
r39485:adacefb0 stable
parent child Browse files
Show More
@@ -382,12 +382,12 b' static PyObject *pack_dirstate(PyObject '
382 382 char *p, *s;
383 383 int now;
384 384
385 if (!PyArg_ParseTuple(args, "O!O!Oi:pack_dirstate", &PyDict_Type, &map,
386 &PyDict_Type, &copymap, &pl, &now))
385 if (!PyArg_ParseTuple(args, "O!O!O!i:pack_dirstate", &PyDict_Type, &map,
386 &PyDict_Type, &copymap, &PyTuple_Type, &pl, &now))
387 387 return NULL;
388 388
389 if (!PySequence_Check(pl) || PySequence_Size(pl) != 2) {
390 PyErr_SetString(PyExc_TypeError, "expected 2-element sequence");
389 if (PyTuple_Size(pl) != 2) {
390 PyErr_SetString(PyExc_TypeError, "expected 2-element tuple");
391 391 return NULL;
392 392 }
393 393
@@ -416,14 +416,14 b' static PyObject *pack_dirstate(PyObject '
416 416
417 417 p = PyBytes_AS_STRING(packobj);
418 418
419 pn = PySequence_ITEM(pl, 0);
419 pn = PyTuple_GET_ITEM(pl, 0);
420 420 if (PyBytes_AsStringAndSize(pn, &s, &l) == -1 || l != 20) {
421 421 PyErr_SetString(PyExc_TypeError, "expected a 20-byte hash");
422 422 goto bail;
423 423 }
424 424 memcpy(p, s, l);
425 425 p += 20;
426 pn = PySequence_ITEM(pl, 1);
426 pn = PyTuple_GET_ITEM(pl, 1);
427 427 if (PyBytes_AsStringAndSize(pn, &s, &l) == -1 || l != 20) {
428 428 PyErr_SetString(PyExc_TypeError, "expected a 20-byte hash");
429 429 goto bail;
@@ -713,7 +713,7 b' void dirs_module_init(PyObject *mod);'
713 713 void manifest_module_init(PyObject *mod);
714 714 void revlog_module_init(PyObject *mod);
715 715
716 static const int version = 5;
716 static const int version = 10;
717 717
718 718 static void module_init(PyObject *mod)
719 719 {
@@ -1392,9 +1392,9 b' class dirstatemap(object):'
1392 1392
1393 1393 l = len(st)
1394 1394 if l == 40:
1395 self._parents = st[:20], st[20:40]
1395 self._parents = (st[:20], st[20:40])
1396 1396 elif l == 0:
1397 self._parents = [nullid, nullid]
1397 self._parents = (nullid, nullid)
1398 1398 else:
1399 1399 raise error.Abort(_('working directory state appears '
1400 1400 'damaged!'))
@@ -69,7 +69,7 b' def _importfrom(pkgname, modname):'
69 69 (r'cext', r'bdiff'): 3,
70 70 (r'cext', r'mpatch'): 1,
71 71 (r'cext', r'osutil'): 4,
72 (r'cext', r'parsers'): 5,
72 (r'cext', r'parsers'): 10,
73 73 }
74 74
75 75 # map import request to other package or module
General Comments 0
You need to be logged in to leave comments. Login now