This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

bug in EUC/SHIFT-JISX0213 converters



This fixes a bug in the EUC-JISX0213 and SHIFT_JISX0213 converters: in some
cases the input pointer would be advanced although the loop stops with
result __GCONV_FULL_OUTPUT.

2002-05-12  Bruno Haible  <bruno@clisp.org>

	* iconvdata/euc-jisx0213.c (BODY for FROM_LOOP): Don't advance inptr
	when there is not enough room in the output buffer.
	* iconvdata/shift_jisx0213.c (BODY for FROM_LOOP): Likewise.

--- glibc-20020425/iconvdata/euc-jisx0213.c.bak	2002-04-25 15:44:11.000000000 +0200
+++ glibc-20020425/iconvdata/euc-jisx0213.c	2002-05-11 19:09:32.000000000 +0200
@@ -195,8 +201,6 @@
 		break;							      \
 	      }								      \
 									      \
-	    inptr = endp;						      \
-									      \
 	    if (ch < 0x80)						      \
 	      {								      \
 		/* It's a combining character.  */			      \
@@ -206,6 +210,7 @@
 		/* See whether we have room for two characters.  */	      \
 		if (outptr + 8 <= outend)				      \
 		  {							      \
+		    inptr = endp;					      \
 		    put32 (outptr, u1);					      \
 		    outptr += 4;					      \
 		    put32 (outptr, u2);					      \
@@ -218,6 +223,8 @@
 		    break;						      \
 		  }							      \
 	      }								      \
+									      \
+	    inptr = endp;						      \
 	  }								      \
       }									      \
     else								      \
--- glibc-20020425/iconvdata/shift_jisx0213.c.bak	2002-04-25 15:44:13.000000000 +0200
+++ glibc-20020425/iconvdata/shift_jisx0213.c	2002-05-11 19:09:30.000000000 +0200
@@ -185,8 +191,6 @@
 	    break;							      \
 	  }								      \
 									      \
-	inptr += 2;							      \
-									      \
 	if (ch < 0x80)							      \
 	  {								      \
 	    /* It's a combining character.  */				      \
@@ -196,6 +200,7 @@
 	    /* See whether we have room for two characters.  */		      \
 	    if (outptr + 8 <= outend)					      \
 	      {								      \
+		inptr += 2;						      \
 		put32 (outptr, u1);					      \
 		outptr += 4;						      \
 		put32 (outptr, u2);					      \
@@ -208,6 +213,8 @@
 		break;							      \
 	      }								      \
 	  }								      \
+									      \
+	inptr += 2;							      \
       }									      \
     else								      \
       {									      \


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]