mirror of
https://github.com/facebook/sapling.git
synced 2024-10-06 23:07:18 +03:00
pathencode: check result of .digest() method in sha1hash
Without this it was theoretically possible .digest() would fail and return NULL but we wouldn't notice. Detected with cpychecker.
This commit is contained in:
parent
d203bdeed3
commit
f28f2e0f50
@ -684,6 +684,8 @@ static int sha1hash(char hash[20], const char *str, Py_ssize_t len)
|
||||
|
||||
hashobj = PyObject_CallMethod(shaobj, "digest", "");
|
||||
Py_DECREF(shaobj);
|
||||
if (hashobj == NULL)
|
||||
return -1;
|
||||
|
||||
if (!PyString_Check(hashobj) || PyString_GET_SIZE(hashobj) != 20) {
|
||||
PyErr_SetString(PyExc_TypeError,
|
||||
|
Loading…
Reference in New Issue
Block a user