Source-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: src/usr.bin/xlint/lint1



Module Name:    src
Committed By:   rillig
Date:           Tue Jun 15 20:46:46 UTC 2021

Modified Files:
        src/usr.bin/xlint/lint1: externs1.h lex.c lint1.h tree.c

Log Message:
lint: replace array access with function calls

First and foremost, the test d_c99_complex_split accessed the array
qlmasks out-of-bounds, with an index of 128 for the type 'double
_Complex'.  This invoked undefined behavior since the maximum allowed
index was 64.

Replacing the raw array accesses with function calls allows for bounds
checks to catch these errors early.

Determining the value bits for a 'double _Complex' does not make sense
at all since it is not an integer type.  This means that lint didn't
handle these types correctly for several years.  Support for int128_t
has been added in inittyp.c 1.12 from 2018-09-07, support for _Complex
has been added in inittyp.c 1.9 from 2008-04-26.

Determining the value bits for an int128_t would make sense, but the
unit tests don't contain examples for this type since at the moment all
unit tests must produce the same results on 32-bit and 64-bit platforms,
and the 32-bit platforms don't support int128_t.


To generate a diff of this commit:
cvs rdiff -u -r1.108 -r1.109 src/usr.bin/xlint/lint1/externs1.h
cvs rdiff -u -r1.36 -r1.37 src/usr.bin/xlint/lint1/lex.c
cvs rdiff -u -r1.101 -r1.102 src/usr.bin/xlint/lint1/lint1.h
cvs rdiff -u -r1.286 -r1.287 src/usr.bin/xlint/lint1/tree.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.




Home | Main Index | Thread Index | Old Index