Page MenuHomeFreeBSD

msdosfs: fixes for Undefined Behavior.
ClosedPublic

Authored by pfg on Aug 7 2018, 3:48 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mar 7 2024, 8:19 PM
Unknown Object (File)
Nov 9 2023, 10:16 AM
Unknown Object (File)
Oct 19 2023, 11:24 PM
Unknown Object (File)
Sep 16 2023, 9:09 PM
Unknown Object (File)
Sep 5 2023, 11:03 PM
Unknown Object (File)
Sep 5 2023, 11:02 PM
Unknown Object (File)
Aug 31 2023, 11:49 PM
Unknown Object (File)
Jun 29 2023, 2:50 PM
Subscribers

Details

Reviewers
emaste
delphij
Summary

These were found by the Undefined Behaviour GsoC project at NetBSD:

Do not change signedness bit with left shift.
While there avoid signed integer overflow.
Address both issues with using unsigned type.

msdosfs_fat.c:512:42, left shift of 1 by 31 places cannot be represented
in type 'int'
msdosfs_fat.c:521:44, left shift of 1 by 31 places cannot be represented
in type 'int'
msdosfs_fat.c:744:14, left shift of 1 by 31 places cannot be represented
in type 'int'
msdosfs_fat.c:744:24, signed integer overflow: -2147483648 - 1 cannot be
represented in type 'int [20]'
msdosfs_fat.c:840:13, left shift of 1 by 31 places cannot be represented
in type 'int'
msdosfs_fat.c:840:36, signed integer overflow: -2147483648 - 1 cannot be
represented in type 'int [20]'

Detected with micro-UBSan in the user mode.

Hinted from: NetBSD

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 18626
Build 18315: arc lint + arc unit