mirror of
https://git.FreeBSD.org/src.git
synced 2024-10-19 02:29:40 +00:00
usr.bin/diff: fix UBSan error in readhash
UBSan complains about the `sum = sum * 127 + chrtran(t);` line below since
that can overflow an `int`. Use `unsigned int` instead to ensure that
overflow is well-defined.
Reviewed By: imp
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D31075
(cherry picked from commit c78f449d85
)
This commit is contained in:
parent
608cb96312
commit
7a7324d9ce
@ -1345,7 +1345,7 @@ static int
|
||||
readhash(FILE *f, int flags)
|
||||
{
|
||||
int i, t, space;
|
||||
int sum;
|
||||
unsigned sum;
|
||||
|
||||
sum = 1;
|
||||
space = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user