Skip to content

Conversation

@depressed-pho
Copy link

The primary purpose of these changes is for compatibility with NetBSD, but nothing is NetBSD-specific.

…HECK_HEADERS

The primary purpose of this change is to support NetBSD.
No functional changes intended.
According to POSIX.1 the argument of ctype(3) functions, including
toupper(3), has to either be EOF or a value representable as an unsigned
char. If the argument has any other value, the behavior is undefined. This
means values of signed char must first be cast to unsigned char, otherwise
they will be outside the range of allowed values.

glibc attempts to avoid the undefined behavior by defining the functions to
work for all integer inputs representable by either an unsigned char or a
signed char. NetBSD libc does not, and causes a segfault if the value is
invalid.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant