git: b138d017c704 - main - libc/locale: Check EILSEQ return
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 04 Nov 2026 04:09:41 UTC
The branch main has been updated by aokblast:
URL: https://cgit.FreeBSD.org/src/commit/?id=b138d017c70421e9d074096fcc3ac676f7e1c846
commit b138d017c70421e9d074096fcc3ac676f7e1c846
Author: ShengYi Hung <aokblast@FreeBSD.org>
AuthorDate: 2026-11-03 05:54:14 +0000
Commit: ShengYi Hung <aokblast@FreeBSD.org>
CommitDate: 2026-11-04 04:09:36 +0000
libc/locale: Check EILSEQ return
_citrus_iconv_std_iconv_convert can return EILSEQ without setting
invlen. As a result, we should check EILSEQ in the return value or it
will incorrectly return -2
Reviewed by: kevans
Fixes: e2030ca246a7 ("libc: fix c*rtomb/mbrtoc*")
MFC after: 2 days
Differential Revision: https://reviews.freebsd.org/D61151
---
lib/libc/locale/mbrtocXX_iconv.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/libc/locale/mbrtocXX_iconv.h b/lib/libc/locale/mbrtocXX_iconv.h
index 35d0fd914b1f..a6286fc3c893 100644
--- a/lib/libc/locale/mbrtocXX_iconv.h
+++ b/lib/libc/locale/mbrtocXX_iconv.h
@@ -123,7 +123,7 @@ mbrtocXX_l(charXX_t * __restrict pc, const char * __restrict s, size_t n,
continue;
/* Illegal sequence. */
- if (invlen > 0) {
+ if (invlen > 0 || err == EILSEQ) {
cs->srcbuf_len = 0;
errno = EILSEQ;
return ((size_t)-1);