[libxml2] Fix integer conversion warning in xmlIconvWrapper



commit 7abc6e6a24ee571001eaecb26916dbfd3602c76a
Author: Nick Wellnhofer <wellnhofer aevum de>
Date:   Tue Jan 25 02:27:53 2022 +0100

    Fix integer conversion warning in xmlIconvWrapper
    
    Use size_t for return value of iconv(3) to avoid an UBSan integer
    conversion warning.

 encoding.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/encoding.c b/encoding.c
index 5e7b03af..3741c94e 100644
--- a/encoding.c
+++ b/encoding.c
@@ -1823,7 +1823,7 @@ xmlIconvWrapper(iconv_t cd, unsigned char *out, int *outlen,
     size_t icv_inlen, icv_outlen;
     const char *icv_in = (const char *) in;
     char *icv_out = (char *) out;
-    int ret;
+    size_t ret;
 
     if ((out == NULL) || (outlen == NULL) || (inlen == NULL) || (in == NULL)) {
         if (outlen != NULL) *outlen = 0;
@@ -1834,7 +1834,7 @@ xmlIconvWrapper(iconv_t cd, unsigned char *out, int *outlen,
     ret = iconv(cd, (ICONV_CONST char **) &icv_in, &icv_inlen, &icv_out, &icv_outlen);
     *inlen -= icv_inlen;
     *outlen -= icv_outlen;
-    if ((icv_inlen != 0) || (ret == -1)) {
+    if ((icv_inlen != 0) || (ret == (size_t) -1)) {
 #ifdef EILSEQ
         if (errno == EILSEQ) {
             return -2;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]