Message 78312 - Python tracker (original) (raw)

If view.len is negative, EVP_hash() may read invalid memory :-/ Be careful of integer overflow in this block:

Py_ssize_t offset = 0, sublen = len; while (sublen) { unsigned int process = sublen > MUNCH_SIZE ? MUNCH_SIZE : sublen; ... }

You removed Py_SAFE_DOWNCAST(len, Py_ssize_t, unsigned int) which should be used (eg. on process?).

Note: you might modify len directly instead of using a second variable (sublen), and cp instead of using an offset.