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

(cherry picked from commit c78f449d85e0b292fe5d942cca99f11c1cd430fa)

Details

Provenance
arichardsonAuthored on Jul 6 2021, 11:16 AM
Reviewer
imp
Differential Revision
D31075: usr.bin/diff: fix UBSan error in readhash
Parents
rG608cb9631239: usr.bin/login: send errors to console if syslog isn't running
Branches
Unknown
Tags
Unknown