From ba855735fbd71ebcaaae399e4af5a63947978ef1 Mon Sep 17 00:00:00 2001 From: Intel A80486DX2-66 Date: Sun, 21 Jan 2024 14:05:52 +0300 Subject: [PATCH] template.c: fix possible division by zero --- src/template.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/template.c b/src/template.c index 9077a74..c368ba7 100644 --- a/src/template.c +++ b/src/template.c @@ -195,7 +195,13 @@ main(void) (uintmax_t) (sizeof(SAMPLE_TYPE) / sizeof(uint8_t))); exit(EXIT_FAILURE); } - const size_t MAX = (PRODUCT + (BLOCK_SIZE - 1)) / BLOCK_SIZE; + const size_t MAX = +#if BLOCK_SIZE > 0 + (PRODUCT + (BLOCK_SIZE - 1)) / BLOCK_SIZE +#else + 0 +#endif + ; size_t w = 0; for (size_t seq = 0; seq < MAX; seq++) {