1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-03-31 06:50:06 +03:00

encoding: Handle iconv() returning EOPNOTSUPP on Apple

iconv() really shouldn't return undocumented error codes.
This commit is contained in:
Nick Wellnhofer 2025-02-01 15:29:56 +01:00
parent 8d7e38d536
commit c4f760be8a

View File

@ -1117,6 +1117,14 @@ xmlIconvConvert(unsigned char *out, int *outlen,
*/
if (errno == EINVAL)
return(XML_ENC_ERR_SUCCESS);
#ifdef __APPLE__
/*
* Apple's new libiconv can return EOPNOTSUPP under
* unknown circumstances (detected when fuzzing).
*/
if (errno == EOPNOTSUPP)
return(XML_ENC_ERR_INPUT);
#endif
return(XML_ENC_ERR_INTERNAL);
}
return(XML_ENC_ERR_SUCCESS);