The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=c78f449d85e0b292fe5d942cca99f11c1cd430fa
commit c78f449d85e0b292fe5d942cca99f11c1cd430fa Author: Alex Richardson <[email protected]> AuthorDate: 2021-07-06 11:16:40 +0000 Commit: Alex Richardson <[email protected]> CommitDate: 2021-07-06 11:16:40 +0000 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 --- usr.bin/diff/diffreg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.bin/diff/diffreg.c b/usr.bin/diff/diffreg.c index 1b28281024c6..651ec88df909 100644 --- a/usr.bin/diff/diffreg.c +++ b/usr.bin/diff/diffreg.c @@ -1345,7 +1345,7 @@ static int readhash(FILE *f, int flags) { int i, t, space; - int sum; + unsigned sum; sum = 1; space = 0; _______________________________________________ [email protected] mailing list https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main To unsubscribe, send any mail to "[email protected]"
