Page MenuHomeFreeBSD

libc: fix c*rtomb/mbrtoc*
ClosedPublic

Authored by kevans on Aug 20 2023, 4:41 AM.
Tags
None
Referenced Files
Unknown Object (File)
Apr 22 2024, 4:25 PM
Unknown Object (File)
Apr 21 2024, 11:47 AM
Unknown Object (File)
Apr 19 2024, 5:51 PM
Unknown Object (File)
Apr 18 2024, 10:32 PM
Unknown Object (File)
Apr 16 2024, 11:47 AM
Unknown Object (File)
Apr 16 2024, 1:08 AM
Unknown Object (File)
Apr 16 2024, 1:07 AM
Unknown Object (File)
Apr 16 2024, 12:46 AM
Subscribers

Details

Reviewers
markj
des
Group Reviewers
Klara
Commits
rGe2030ca246a7: libc: fix c*rtomb/mbrtoc*
Summary

In 693f88c9da8d ("iconv_std: complete the IGNORE support"), we
more completely implemented
IGNORE, which changed the semantics of
ci_discard_ilseq. DISCARD_ILSEQ semantics are supposed to match
//IGNORE, so we really can't do much about that particular
incompatibility. This broke c*rtomb and mbrtoc* handling of invalid
sequences, but it turns out they don't want DISCARD_ILSEQ semantics at
all; they really want the subset that we call
_CITRUS_ICONV_F_HIDE_INVALID.

While we're here, zero out cv_shared on initialization so that we don't
have to do so at every caller to make it a little less error prone.

Fixes: 693f88c9da8d ("iconv_std: complete the //IGNORE support")

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Missed:

PR: 265871

CC @lwhsu, we should be able to un-skip the c16rtomb tests we skipped there after this.

lib/libc/locale/cXXrtomb_iconv.h
78

Now this field is initialized to 0. Is that a bug in the change to use calloc(), or is it intentional? I don't know this code well enough to judge for myself.

lib/libc/locale/cXXrtomb_iconv.h
78

Ah, sorry, should have called that out specifically- yeah, the functional part of the change is setting this to false and passing the flag below in its place so that we still get EILSEQ, we just don't get the do_conv() replacement chars in iconv_std

Split out the zero-initialization bits, since they're not related to the fix
at hand.

This revision was not accepted when it landed; it landed in state Needs Review.Aug 23 2023, 3:42 AM
This revision was automatically updated to reflect the committed changes.