Skip to content

Commit 82829d8

Browse files
committed
strenghten assertions
1 parent 8abac26 commit 82829d8

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Modules/sha3module.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,9 @@ _SHAKE_digest(SHA3object *self, Py_ssize_t digestlen, int hex)
502502
* - the output length is zero -- we follow the existing behavior and return
503503
* an empty digest, without raising an error */
504504
if (digestlen > 0) {
505+
#if PY_SSIZE_T_MAX > UINT32_MAX
506+
assert(digestlen <= (Py_ssize_t)UINT32_MAX);
507+
#endif
505508
(void)Hacl_Hash_SHA3_squeeze(self->hash_state, digest,
506509
(uint32_t)digestlen);
507510
}

0 commit comments

Comments
 (0)