Date: Thu, 5 Aug 2021 09:25:47 GMT From: Alex Richardson <arichardson@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: 7a7324d9cebe - stable/13 - usr.bin/diff: fix UBSan error in readhash Message-ID: <202108050925.1759PlrS006606@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=7a7324d9cebee6f42d77a39f3a8c657e23676cc2 commit 7a7324d9cebee6f42d77a39f3a8c657e23676cc2 Author: Alex Richardson <arichardson@FreeBSD.org> AuthorDate: 2021-07-06 11:16:40 +0000 Commit: Alex Richardson <arichardson@FreeBSD.org> CommitDate: 2021-08-05 08:59:26 +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 (cherry picked from commit c78f449d85e0b292fe5d942cca99f11c1cd430fa) --- 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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202108050925.1759PlrS006606>