Source-Changes archive

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

CVS commit: src/usr.bin/xlint



Module Name:    src
Committed By:   rillig
Date:           Tue Aug 31 17:22:25 UTC 2021

Modified Files:
        src/usr.bin/xlint/common: externs.h mem.c
        src/usr.bin/xlint/lint1: mem1.c
        src/usr.bin/xlint/lint2: mem2.c

Log Message:
lint: fix memory allocation (since 2021-08-28)

In mem1.c 1.50 and mem2.c 1.13 from 2021-08-28, I accidentally changed
the initialization of mblklen from round_up to round_down, trying to
avoid a division instruction.

On NetBSD x86_64 this resulted in a few more malloc calls, but on Cygwin
with its 64k pagesize, mblklen became 0.  Later, the function xalloc in
lint2 called xalloc(mblklen) and blindly assumed that the returned
memory would be large enough.  This in turn led to out-of-bounds memory
access and crashes.  Lint1 was not affected since it adjust mblklen
during runtime if it gets too small.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/usr.bin/xlint/common/externs.h
cvs rdiff -u -r1.18 -r1.19 src/usr.bin/xlint/common/mem.c
cvs rdiff -u -r1.51 -r1.52 src/usr.bin/xlint/lint1/mem1.c
cvs rdiff -u -r1.13 -r1.14 src/usr.bin/xlint/lint2/mem2.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