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)
Sun, Jan 5, 8:21 PM
Unknown Object (File)
Nov 8 2024, 7:12 AM
Unknown Object (File)
Nov 8 2024, 7:00 AM
Unknown Object (File)
Nov 8 2024, 4:43 AM
Unknown Object (File)
Oct 21 2024, 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
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