From b5b4c7fed589aef04f6b5add5f0f0d9c2f1fd2f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?jackerli=28=E6=9D=8E=E5=89=91=29?= Date: Wed, 28 Sep 2022 16:41:59 +0800 Subject: [PATCH] fix: arc4_getword integer overflow, detected by -fsanitize=undefined --- arc4random.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arc4random.c b/arc4random.c index b5f66b4c6f..c9533b1741 100644 --- a/arc4random.c +++ b/arc4random.c @@ -418,7 +418,7 @@ arc4_getword(void) { unsigned int val; - val = arc4_getbyte() << 24; + val = (unsigned)arc4_getbyte() << 24; val |= arc4_getbyte() << 16; val |= arc4_getbyte() << 8; val |= arc4_getbyte();