Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 18 Mar 2002 18:21:12 +0900
From:      "Akinori MUSHA" <knu@iDaemons.org>
To:        Konstantin.Chuguev@dante.org.uk
Cc:        FreeBSD-ports <ports@FreeBSD.org>
Subject:   fixes for iconv 2.0
Message-ID:  <86wuwansdz.wl@archon.local.idaemons.org>

next in thread | raw e-mail | index | archive | help
Hi,

Do you still maintain this library?  I have a patch to fix some bugs
where iconv() doesn't properly return -1 on conversion error.

Reported by: Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>

-- 
                     /
                    /__  __            Akinori.org / MUSHA.org
                   / )  )  ) )  /     FreeBSD.org / Ruby-lang.org
Akinori MUSHA aka / (_ /  ( (__(  @ iDaemons.org / and.or.jp

"Somewhere out of a memory.. of lighted streets on quiet nights.."

--- lib/converter.c.orig	Sun Nov 26 22:10:22 2000
+++ lib/converter.c	Mon Mar 18 17:55:50 2002
@@ -92,14 +92,14 @@
 		if (ch == UCS_CHAR_NONE) {
 			/* Incomplete character in input buffer */
 			errno = EINVAL;
-			return res;
+			return (size_t)(-1);
 		}
 		if (ch == UCS_CHAR_INVALID) {
 			/* Invalid character in source buffer */
 			*inbytesleft += *inbuf - ptr;
 			*inbuf = ptr;
 			errno = EILSEQ;
-			return res;
+			return (size_t)(-1);
 		}
 		size = ICONV_CES_CONVERT_FROM_UCS(&(uc->to), ch,
 		                                  outbuf, outbytesleft);
@@ -116,7 +116,7 @@
 			*inbytesleft += *inbuf - ptr;
 			*inbuf = ptr; 
 			errno = E2BIG;
-			return res;
+			return (size_t)(-1);
 		}
 	}
 	return res;
@@ -163,8 +163,10 @@
 		*inbytesleft -= len;
 		*outbuf += len;
 		*outbytesleft -= len;
+		return 0;
 	}
-	return 0;
+
+	return (size_t)(-1);
 }
 
 iconv_converter *

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?86wuwansdz.wl>