summary refs log tree commit diff
path: root/libio/freopen.c
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2022-07-05 09:05:22 +0200
committerFlorian Weimer <fweimer@redhat.com>2022-07-05 09:06:28 +0200
commit19d494445981a09503e4a0175732745c39dd7c21 (patch)
tree435b8d0a6ad02c03f537612497de68f27dacf223 /libio/freopen.c
parent5dcbff5879a7d25e0dd511f4a71c039aa015e6a4 (diff)
downloadglibc-19d494445981a09503e4a0175732745c39dd7c21.tar.gz
glibc-19d494445981a09503e4a0175732745c39dd7c21.tar.xz
glibc-19d494445981a09503e4a0175732745c39dd7c21.zip
locale: Fix signed char bug in lr_getc
The array lr->buf contains characters, which can be signed.  A 0xff
byte in the input could be incorrectly reported as EOF.  More
importantly, get_string in linereader.c converts a signed input byte
to a Unicode code point using ADDWC ((uint32_t) ch), under the
assumption that this decodes the ISO-8859-1 input encoding.  If char
is signed, this does not give the correct result.  This means that
ISO-8859-1 input files for localedef are not actually supported,
contrary to the comment in get_string.  This is a happy accident because
we can therefore change the file encoding to UTF-8 without impacting
backwards compatibility.

While at it, remove the \32 check for MS-DOS end-of-file character (^Z).

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
Diffstat (limited to 'libio/freopen.c')
0 files changed, 0 insertions, 0 deletions