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
F152596019: D31075.id91877.diff
Wed, Apr 15, 9:50 PM
F152594678: D31075.id91877.diff
Wed, Apr 15, 9:39 PM
F152453883: D31075.diff
Wed, Apr 15, 1:51 AM
Unknown Object (File)
Tue, Apr 7, 10:08 PM
Unknown Object (File)
Mon, Apr 6, 4:27 PM
Unknown Object (File)
Tue, Mar 17, 2:00 AM
Unknown Object (File)
Mar 6 2026, 4:04 PM
Unknown Object (File)
Feb 8 2026, 3:24 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