HomeFreeBSD

usr.bin/diff: fix UBSan error in readhash

Description

usr.bin/diff: fix UBSan error in readhash

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.

Reviewed By: imp
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D31075

Details

Provenance
arichardsonAuthored on Jul 6 2021, 11:16 AM
Reviewer
imp
Differential Revision
D31075: usr.bin/diff: fix UBSan error in readhash
Parents
rG31914882fca5: Import Arm Optimized Routines v21.02
Branches
Unknown
Tags
Unknown