Page MenuHomeFreeBSD

usr.bin/diff: fix UBSan error in readhash
ClosedPublic

Authored by arichardson on Jul 6 2021, 11:03 AM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Oct 15, 3:21 PM
Unknown Object (File)
Thu, Oct 15, 6:45 AM
Unknown Object (File)
Tue, Oct 6, 6:36 PM
Unknown Object (File)
Tue, Oct 6, 1:20 PM
Unknown Object (File)
Tue, Oct 6, 6:52 AM
Unknown Object (File)
Tue, Oct 6, 6:17 AM
Unknown Object (File)
Sun, Oct 4, 3:12 AM
Unknown Object (File)
Sep 11 2026, 2:58 PM
Subscribers

Details

Summary

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.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable