#1050611 /usr/bin/iconv: iconv use_from_charmap mixes up char_table and byte_table

Package:
libc-bin
Source:
libc-bin
Description:
GNU C Library: Binaries
Submitter:
Date:
2023-08-27 03:21:04 UTC
Severity:
normal
Tags:
#1050611#5
Date:
2023-08-27 03:16:59 UTC
From:
To:
Dear Maintainer,

The iconv program, following POSIX, allows charmap files to be used
directly for conversion without having to be compiled into a gconv
module. For example,

    iconv -f ./palimpsest.charmap

This is a very handy feature as it allows end users to quickly make
custom mappings without needing to compile a gconv module.
Unfortunately, due to a simple bug (using the wrong hash table), iconv
scrambles the conversion when the char hash table is realloc'd.

Changing `char_table` to `byte_table` in iconv/iconv_charmap.c:339
will fix this. (Patch attached.)

An example file, palimpsest.char, that exercises this bug is also
attached.

Current version of iconv:

	$ echo 0123456789 | iconv -f ./palimpsest.charmap
	෦꩑꧒꧓४꘥꧖෭෮෯

Patched version of iconv:

	$ echo 0123456789 | iconv -f ./palimpsest.charmap
	0123456789