Source-Changes archive

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

CVS commit: src



Module Name:    src
Committed By:   riastradh
Date:           Mon Sep 15 00:11:55 UTC 2025

Modified Files:
        src/distrib/sets/lists/debug: mi
        src/distrib/sets/lists/tests: mi
        src/lib/libc/gen: ctype_.c ctype_guard.h isctype.c tolower_.c
            toupper_.c
        src/lib/libc/locale: Makefile.inc rune.c
        src/tests/lib/libc/gen: Makefile t_ctype.c
Added Files:
        src/tests/lib/libc/gen: h_ctype_abuse.c

Log Message:
ctype(3): New environment variable LIBC_ALLOWCTYPEABUSE.

If set, this does not force the ctype(3) functions to crash when
passed invalid inputs -- instead, they will return nonsense results,
and possibly print warnings to stderr, as is their right in
implementing undefined behaviour.

The nature of the nonsense results is unspecified.  Currently, is*()
will always return true (even if that leads to mutually contradictory
conclusions, like isalpha and isdigit, or isgraph and isblank), and
tolower/toupper() will always return EOF.  But perhaps in the future
the results may be randomized.

This way, if an application like firefox crashes on ctype abuse, you
can opt to accept the consequences of nonsense results instead by
running `env LIBC_ALLOWCTYPEABUSE= firefox' until the application is
fixed.

PR lib/58208: ctype(3) provides poor runtime feedback of abuse


To generate a diff of this commit:
cvs rdiff -u -r1.485 -r1.486 src/distrib/sets/lists/debug/mi
cvs rdiff -u -r1.1393 -r1.1394 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.23 -r1.24 src/lib/libc/gen/ctype_.c
cvs rdiff -u -r1.7 -r1.8 src/lib/libc/gen/ctype_guard.h
cvs rdiff -u -r1.28 -r1.29 src/lib/libc/gen/isctype.c
cvs rdiff -u -r1.17 -r1.18 src/lib/libc/gen/tolower_.c \
    src/lib/libc/gen/toupper_.c
cvs rdiff -u -r1.68 -r1.69 src/lib/libc/locale/Makefile.inc
cvs rdiff -u -r1.49 -r1.50 src/lib/libc/locale/rune.c
cvs rdiff -u -r1.60 -r1.61 src/tests/lib/libc/gen/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/lib/libc/gen/h_ctype_abuse.c
cvs rdiff -u -r1.11 -r1.12 src/tests/lib/libc/gen/t_ctype.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