Module Name: src Committed By: rillig Date: Wed Sep 13 20:31:58 UTC 2023
Modified Files: src/usr.bin/xlint/common: lint.h src/usr.bin/xlint/lint1: ckctype.c debug.c emit1.c lint1.h op.h oper.c ops.def tree.c Log Message: lint: prevent invalid memory access when checking an expression In check_expr_misc, the left and right operands of an expression were accessed even in the case of CON (constant), STRING (string literal) and NAME (identifier), which led to invalid values in pointer variables. These invalid values were not used though, but technically they invoked undefined behavior. Precede each access to the operands with a check that the expression indeed has operands, except in those cases where the operand is known to have operands by only looking at the code of the current function. To generate a diff of this commit: cvs rdiff -u -r1.43 -r1.44 src/usr.bin/xlint/common/lint.h cvs rdiff -u -r1.6 -r1.7 src/usr.bin/xlint/lint1/ckctype.c cvs rdiff -u -r1.61 -r1.62 src/usr.bin/xlint/lint1/debug.c cvs rdiff -u -r1.76 -r1.77 src/usr.bin/xlint/lint1/emit1.c cvs rdiff -u -r1.200 -r1.201 src/usr.bin/xlint/lint1/lint1.h cvs rdiff -u -r1.21 -r1.22 src/usr.bin/xlint/lint1/op.h cvs rdiff -u -r1.11 -r1.12 src/usr.bin/xlint/lint1/oper.c cvs rdiff -u -r1.30 -r1.31 src/usr.bin/xlint/lint1/ops.def cvs rdiff -u -r1.580 -r1.581 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.