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)
Wed, Nov 5, 12:18 AM
Unknown Object (File)
Tue, Oct 21, 5:09 AM
Unknown Object (File)
Fri, Oct 17, 11:36 PM
Unknown Object (File)
Wed, Oct 15, 2:13 AM
Unknown Object (File)
Wed, Oct 15, 2:13 AM
Unknown Object (File)
Wed, Oct 15, 2:13 AM
Unknown Object (File)
Tue, Oct 14, 5:18 PM
Unknown Object (File)
Oct 12 2025, 3:29 AM
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