kern/185964: Codeset conversion to Chinese Simplified (HZ) is broken / segfaults

Manuel Mausz manuel-freebsd at mausz.at
Fri Jan 24 12:30:01 UTC 2014


The following reply was made to PR kern/185964; it has been noted by GNATS.

From: Manuel Mausz <manuel-freebsd at mausz.at>
To: bug-followup at FreeBSD.org
Cc:  
Subject: Re: kern/185964: Codeset conversion to Chinese Simplified (HZ) is
 broken / segfaults
Date: Fri, 24 Jan 2014 13:22:14 +0100

 This is a multi-part message in MIME format.
 --------------090705060309070305030204
 Content-Type: text/plain; charset=UTF-8
 Content-Transfer-Encoding: 7bit
 
 Attached are patches against head to fix the reported problem + another
 one I discovered during testing:
 
 iconv-void-ptr-ptr.patch
 ...fixes the reported segfault, however HZ conversion still doesn't work.
 
 iconv-HZ-start-comes-before-end.patch
 ...makes HZ conversion work. Verified using libiconv HZ test file.
 
 iconv-VIQR-boundary-check.patch
 ...fixes a missing boundary check crash in VIQR codeset conversion
 module I've discovered.
 
 cheers,
 manuel
 
 --------------090705060309070305030204
 Content-Type: text/x-diff;
  name="iconv-HZ-start-comes-before-end.patch"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: attachment;
  filename="iconv-HZ-start-comes-before-end.patch"
 
 Index: lib/libiconv_modules/HZ/citrus_hz.c
 ===================================================================
 --- lib/libiconv_modules/HZ/citrus_hz.c	(revision 261094)
 +++ lib/libiconv_modules/HZ/citrus_hz.c	(working copy)
 @@ -65,8 +65,8 @@
  } charset_t;
  
  typedef struct {
 +	int	 start;
  	int	 end;
 -	int	 start;
  	int	 width;
  } range_t;
  
 
 --------------090705060309070305030204
 Content-Type: text/x-diff;
  name="iconv-VIQR-boundary-check.patch"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: attachment;
  filename="iconv-VIQR-boundary-check.patch"
 
 Index: lib/libiconv_modules/VIQR/citrus_viqr.c
 ===================================================================
 --- lib/libiconv_modules/VIQR/citrus_viqr.c	(revision 261094)
 +++ lib/libiconv_modules/VIQR/citrus_viqr.c	(working copy)
 @@ -457,7 +457,7 @@
  			return (errnum);
  		}
  	}
 -	for (i = 0;; ++i) {
 +	for (i = 0; i < mnemonic_ext_size; ++i) {
  		p = &mnemonic_ext[i];
  		n = strlen(p->name);
  		if (ei->mb_cur_max < n)
 
 --------------090705060309070305030204
 Content-Type: text/x-diff;
  name="iconv-void-ptr-ptr.patch"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: attachment;
  filename="iconv-void-ptr-ptr.patch"
 
 Index: lib/libc/iconv/citrus_prop.c
 ===================================================================
 --- lib/libc/iconv/citrus_prop.c	(revision 261094)
 +++ lib/libc/iconv/citrus_prop.c	(working copy)
 @@ -436,7 +436,7 @@
  			break;
  		_memstream_ungetc(&ms, ch);
  		errnum = _citrus_prop_parse_element(
 -		    &ms, hints, (void ** __restrict)context);
 +		    &ms, hints, (void ** __restrict)&context);
  		if (errnum != 0)
  			return (errnum);
  	}
 Index: lib/libiconv_modules/BIG5/citrus_big5.c
 ===================================================================
 --- lib/libiconv_modules/BIG5/citrus_big5.c	(revision 261094)
 +++ lib/libiconv_modules/BIG5/citrus_big5.c	(working copy)
 @@ -181,7 +181,7 @@
  
  	if (start > 0xFF || end > 0xFF)
  		return (EINVAL);
 -	ei = (_BIG5EncodingInfo *)ctx;
 +	ei = (_BIG5EncodingInfo *)*ctx;
  	i = strcmp("row", s) ? 1 : 0;
  	i = 1 << i;
  	for (n = start; n <= end; ++n)
 @@ -199,7 +199,7 @@
  
  	if (start > 0xFFFF || end > 0xFFFF)
  		return (EINVAL);
 -	ei = (_BIG5EncodingInfo *)ctx;
 +	ei = (_BIG5EncodingInfo *)*ctx;
  	exclude = TAILQ_LAST(&ei->excludes, _BIG5ExcludeList);
  	if (exclude != NULL && (wint_t)start <= exclude->end)
  		return (EINVAL);
 
 --------------090705060309070305030204--


More information about the freebsd-bugs mailing list