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)
Mon, Oct 21, 6:06 AM
Unknown Object (File)
Oct 6 2024, 8:24 PM
Unknown Object (File)
Sep 22 2024, 2:31 PM
Unknown Object (File)
Sep 18 2024, 11:53 AM
Unknown Object (File)
Sep 5 2024, 12:40 AM
Unknown Object (File)
Aug 18 2024, 10:08 AM
Unknown Object (File)
Aug 14 2024, 4:54 PM
Unknown Object (File)
Jul 28 2024, 2:13 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