Page MenuHomeFreeBSD

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

Authored by arichardson on Jul 6 2021, 11:03 AM.

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
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.