[PATCH 3/3] tests/basic: fix signed interger overflow

Jussi Kivilinna jussi.kivilinna at iki.fi
Tue May 14 18:46:05 CEST 2019


* tests/basic.c (check_ocb_cipher_largebuf_split): Cast to unsigned
when generating buffer values.
--

Signed-off-by: Jussi Kivilinna <jussi.kivilinna at iki.fi>
---
 0 files changed

diff --git a/tests/basic.c b/tests/basic.c
index fd074cba7..0ce88e291 100644
--- a/tests/basic.c
+++ b/tests/basic.c
@@ -5044,7 +5044,7 @@ check_ocb_cipher_largebuf_split (int algo, int keylen, const char *tagexpect,
     }
 
   for (i = 0; i < buflen; i++)
-    inbuf[i] = (i + 181081) * 5039;
+    inbuf[i] = (unsigned int)(i + 181081) * 5039U;
 
   err = gcry_cipher_open (&hde, algo, GCRY_CIPHER_MODE_OCB, 0);
   if (!err)




More information about the Gcrypt-devel mailing list