diff options
author | Mattias Andrée <maandree@kth.se> | 2022-02-03 22:58:29 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2022-02-03 22:58:29 +0100 |
commit | 66ff071274a74ff67d518d194a086e6772d89796 (patch) | |
tree | f4b2a434fb9ee529a2ae7da67d0f076e4cf62f2a /libkeccak_generalised_sum_fd.c | |
parent | Fix zero-copy update to libkeccak_generalised_sum_fd (diff) | |
download | libkeccak-66ff071274a74ff67d518d194a086e6772d89796.tar.gz libkeccak-66ff071274a74ff67d518d194a086e6772d89796.tar.bz2 libkeccak-66ff071274a74ff67d518d194a086e6772d89796.tar.xz |
Fix blksize adjustment when exceeding alloca limit in libkeccak_generalised_sum_fd1.3.1
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
-rw-r--r-- | libkeccak_generalised_sum_fd.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/libkeccak_generalised_sum_fd.c b/libkeccak_generalised_sum_fd.c index e86c459..92a5c4c 100644 --- a/libkeccak_generalised_sum_fd.c +++ b/libkeccak_generalised_sum_fd.c @@ -53,8 +53,12 @@ libkeccak_generalised_sum_fd(int fd, struct libkeccak_state *restrict state, con blksize = (extrachunks + 1) * chunksize; #if ALLOCA_LIMIT > 0 - if (blksize > (size_t)ALLOCA_LIMIT) + if (blksize > (size_t)ALLOCA_LIMIT) { blksize = (size_t)ALLOCA_LIMIT; + blksize -= blksize % chunksize; + if (!blksize) + blksize = chunksize; + } # if defined(__clang__) /* We are using a limit so it's just like declaring an array * in a function, except we might use less of the stack. */ |