Go to file
Florian Weimer 6cbf845fcd iconv: Preserve iconv -c error exit on invalid inputs (bug 32046)
In several converters, a __GCONV_ILLEGAL_INPUT result gets overwritten
with __GCONV_FULL_OUTPUT.  As a result, iconv (the function) returns
E2BIG instead of EILSEQ.  The iconv program does not see the original
EILSEQ failure, does not recognize the invalid input, and may
incorrectly exit successfully.

To address this, a new __flags bit is used to indicate a sticky input
error state.  All __GCONV_ILLEGAL_INPUT results are replaced with a
function call that sets this new __GCONV_ENCOUNTERED_ILLEGAL_INPUT and
returns __GCONV_ILLEGAL_INPUT.  The iconv program checks for
__GCONV_ENCOUNTERED_ILLEGAL_INPUT and overrides the exit status.

The converter changes introducing __gconv_mark_illegal_input are
mostly mechanical, except for the res variable initialization in
iconvdata/iso-2022-jp.c: this error gets overwritten with __GCONV_OK
and other results in the following code.  If res ==
__GCONV_ILLEGAL_INPUT afterwards, STANDARD_TO_LOOP_ERR_HANDLER below
will handle it.

The __gconv_mark_illegal_input changes do not alter the errno value
set by the iconv function.  This is simpler to implement than
reviewing each __GCONV_FULL_OUTPUT result and adjust it not to
override a previous __GCONV_ILLEGAL_INPUT result.  Doing it that way
would also change some E2BIG errors in to EILSEQ errors, so it had to
be done conditionally (under a flag set by the iconv program only), to
avoid confusing buffer management in other applications.

Reviewed-by: DJ Delorie <dj@redhat.com>
2024-09-20 13:51:09 +02:00
advisories
argp
assert
benchtests
bits AArch64: Add vector logp1 alias for log1p 2024-09-19 17:53:34 +01:00
catgets
ChangeLog.old
conform
csu
ctype
debug debug: Fix read error handling in pcprofiledump 2024-09-10 12:40:27 +02:00
dirent
dlfcn
elf elf: Fix tst-dlopen-tlsreinit1.out test dependency 2024-09-09 21:10:23 +02:00
gmon
gnulib
hesiod
htl
hurd
iconv iconv: Preserve iconv -c error exit on invalid inputs (bug 32046) 2024-09-20 13:51:09 +02:00
iconvdata iconv: Preserve iconv -c error exit on invalid inputs (bug 32046) 2024-09-20 13:51:09 +02:00
include stdlib: Do not use GLIBC_PRIVATE ABI for errno in libc_nonshared.a 2024-09-06 14:07:00 +02:00
inet inet: Avoid label at end of compound statement in tst-if_nameindex 2024-08-26 16:45:31 +02:00
intl
io io: Add FUSE-based test for fchmod 2024-09-09 09:51:50 +02:00
libio Fix freopen handling of ,ccs= (bug 23675) 2024-09-05 20:08:10 +00:00
locale
localedata
login
mach
malloc
manual manual: __is_last is no longer part of iconv internals 2024-09-20 13:51:09 +02:00
math AArch64: Add vector logp1 alias for log1p 2024-09-19 17:53:34 +01:00
mathvec
misc
nis
nptl
nptl_db
nscd
nss
po
posix
resolv
resource
rt
scripts tst: Extend cross-test-ssh.sh to support passing glibc tunables 2024-09-14 12:54:18 +02:00
setjmp
signal
socket
soft-fp
stdio-common Add a new fwrite test for memory streams 2024-09-09 15:58:07 -03:00
stdlib Do not set errno for overflowing NaN payload in strtod/nan (bug 32045) 2024-09-04 13:21:23 +00:00
string
sunrpc
support support: Fix Hurd build of tst-support_readdir 2024-09-12 18:26:04 +02:00
sysdeps AArch64: Add vector logp1 alias for log1p 2024-09-19 17:53:34 +01:00
sysvipc
termios
time
timezone timezone: sync to TZDB 2024b 2024-09-05 20:57:17 +00:00
wcsmbs
wctype
.clang-format
.gitattributes
.gitignore
abi-tags
aclocal.m4
config.h.in
config.make.in
configure
configure.ac
CONTRIBUTED-BY
COPYING
COPYING.LIB
extra-lib.mk
gen-locales.mk
INSTALL
libc-abis
libof-iterator.mk
LICENSES
MAINTAINERS
Makeconfig
Makefile
Makefile.help
Makefile.in
Makerules
NEWS Linux: Add the sched_setattr and sched_getattr functions 2024-09-11 10:05:08 +02:00
o-iterator.mk
README
Rules
SECURITY.md
SHARED-FILES timezone: sync to TZDB 2024b 2024-09-05 20:57:17 +00:00
shlib-versions
test-skeleton.c
version.h

This directory contains the sources of the GNU C Library.
See the file "version.h" for what release version you have.

The GNU C Library is the standard system C library for all GNU systems,
and is an important part of what makes up a GNU system.  It provides the
system API for all programs written in C and C-compatible languages such
as C++ and Objective C; the runtime facilities of other programming
languages use the C library to access the underlying operating system.

In GNU/Linux systems, the C library works with the Linux kernel to
implement the operating system behavior seen by user applications.
In GNU/Hurd systems, it works with a microkernel and Hurd servers.

The GNU C Library implements much of the POSIX.1 functionality in the
GNU/Hurd system, using configurations i[4567]86-*-gnu and x86_64-gnu.

When working with Linux kernels, this version of the GNU C Library
requires Linux kernel version 3.2 or later.

Also note that the shared version of the libgcc_s library must be
installed for the pthread library to work correctly.

The GNU C Library supports these configurations for using Linux kernels:

	aarch64*-*-linux-gnu
	alpha*-*-linux-gnu
	arc*-*-linux-gnu
	arm-*-linux-gnueabi
	csky-*-linux-gnuabiv2
	hppa-*-linux-gnu
	i[4567]86-*-linux-gnu
	x86_64-*-linux-gnu	Can build either x86_64 or x32
	loongarch64-*-linux-gnu Hardware floating point, LE only.
	m68k-*-linux-gnu
	microblaze*-*-linux-gnu
	mips-*-linux-gnu
	mips64-*-linux-gnu
	or1k-*-linux-gnu
	powerpc-*-linux-gnu	Hardware or software floating point, BE only.
	powerpc64*-*-linux-gnu	Big-endian and little-endian.
	s390-*-linux-gnu
	s390x-*-linux-gnu
	riscv32-*-linux-gnu
	riscv64-*-linux-gnu
	sh[34]-*-linux-gnu
	sparc*-*-linux-gnu
	sparc64*-*-linux-gnu

If you are interested in doing a port, please contact the glibc
maintainers; see https://www.gnu.org/software/libc/ for more
information.

See the file INSTALL to find out how to configure, build, and install
the GNU C Library.  You might also consider reading the WWW pages for
the C library at https://www.gnu.org/software/libc/.

The GNU C Library is (almost) completely documented by the Texinfo manual
found in the `manual/' subdirectory.  The manual is still being updated
and contains some known errors and omissions; we regret that we do not
have the resources to work on the manual as much as we would like.  For
corrections to the manual, please file a bug in the `manual' component,
following the bug-reporting instructions below.  Please be sure to check
the manual in the current development sources to see if your problem has
already been corrected.

Please see https://www.gnu.org/software/libc/bugs.html for bug reporting
information.  We are now using the Bugzilla system to track all bug reports.
This web page gives detailed information on how to report bugs properly.

The GNU C Library is free software.  See the file COPYING.LIB for copying
conditions, and LICENSES for notices about a few contributions that require
these additional notices to be distributed.  License copyright years may be
listed using range notation, e.g., 1996-2015, indicating that every year in
the range, inclusive, is a copyrightable year that would otherwise be listed
individually.