From owner-svn-src-head@FreeBSD.ORG Tue Apr 1 10:36:16 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CFB488FE; Tue, 1 Apr 2014 10:36:16 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B7DC8F10; Tue, 1 Apr 2014 10:36:16 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s31AaGXs020195; Tue, 1 Apr 2014 10:36:16 GMT (envelope-from tijl@svn.freebsd.org) Received: (from tijl@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s31AaCIZ020166; Tue, 1 Apr 2014 10:36:12 GMT (envelope-from tijl@svn.freebsd.org) Message-Id: <201404011036.s31AaCIZ020166@svn.freebsd.org> From: Tijl Coosemans Date: Tue, 1 Apr 2014 10:36:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r263986 - in head/lib: libc/iconv libiconv_modules/BIG5 libiconv_modules/DECHanyu libiconv_modules/EUCTW libiconv_modules/ISO2022 libiconv_modules/UES libiconv_modules/VIQR libiconv_mod... X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Apr 2014 10:36:17 -0000 Author: tijl Date: Tue Apr 1 10:36:11 2014 New Revision: 263986 URL: http://svnweb.freebsd.org/changeset/base/263986 Log: - In the libiconv module for ISO 2022 restore the original order of the fields of a private struct such that variables of this type are initialised correctly. Fixes conversion from ISO 2022. Also do this in the BIG5 module to prevent similar errors in the future. - In the libiconv module for EUC-TW replace 2^cs with 1<ci_ops->io_uninit_shared == NULL || ci->ci_ops->io_init_context == NULL || ci->ci_ops->io_uninit_context == NULL || - ci->ci_ops->io_convert == NULL) + ci->ci_ops->io_convert == NULL) { + ret = EINVAL; goto err; + } /* initialize the converter */ ret = (*ci->ci_ops->io_init_shared)(ci, src, dst); Modified: head/lib/libc/iconv/citrus_lookup.c ============================================================================== --- head/lib/libc/iconv/citrus_lookup.c Tue Apr 1 10:34:39 2014 (r263985) +++ head/lib/libc/iconv/citrus_lookup.c Tue Apr 1 10:36:11 2014 (r263986) @@ -1,5 +1,5 @@ /* $FreeBSD$ */ -/* $NetBSD: citrus_lookup.c,v 1.6 2009/02/03 04:58:38 lukem Exp $ */ +/* $NetBSD: citrus_lookup.c,v 1.7 2012/05/04 16:45:05 joerg Exp $ */ /*- * Copyright (c)2003 Citrus Project, Modified: head/lib/libc/iconv/citrus_mapper.c ============================================================================== --- head/lib/libc/iconv/citrus_mapper.c Tue Apr 1 10:34:39 2014 (r263985) +++ head/lib/libc/iconv/citrus_mapper.c Tue Apr 1 10:36:11 2014 (r263986) @@ -1,5 +1,5 @@ /* $FreeBSD$ */ -/* $NetBSD: citrus_mapper.c,v 1.7 2008/07/25 14:05:25 christos Exp $ */ +/* $NetBSD: citrus_mapper.c,v 1.10 2012/06/08 07:49:42 martin Exp $ */ /*- * Copyright (c)2003 Citrus Project, @@ -244,8 +244,10 @@ mapper_open(struct _citrus_mapper_area * if (!cm->cm_ops->mo_init || !cm->cm_ops->mo_uninit || !cm->cm_ops->mo_convert || - !cm->cm_ops->mo_init_state) + !cm->cm_ops->mo_init_state) { + ret = EINVAL; goto err; + } /* allocate traits structure */ cm->cm_traits = malloc(sizeof(*cm->cm_traits)); Modified: head/lib/libc/iconv/citrus_memstream.c ============================================================================== --- head/lib/libc/iconv/citrus_memstream.c Tue Apr 1 10:34:39 2014 (r263985) +++ head/lib/libc/iconv/citrus_memstream.c Tue Apr 1 10:36:11 2014 (r263986) @@ -1,5 +1,5 @@ /* $FreeBSD$ */ -/* $NetBSD: citrus_memstream.c,v 1.4 2009/02/03 05:02:12 lukem Exp $ */ +/* $NetBSD: citrus_memstream.c,v 1.5 2012/03/13 21:13:31 christos Exp $ */ /*- * Copyright (c)2003 Citrus Project, @@ -44,8 +44,7 @@ _citrus_memory_stream_getln(struct _citr size_t * __restrict rlen) { const uint8_t *h, *p; - size_t ret; - int i; + size_t i, ret; if (ms->ms_pos>=_region_size(&ms->ms_region)) return (NULL); Modified: head/lib/libc/iconv/citrus_mmap.c ============================================================================== --- head/lib/libc/iconv/citrus_mmap.c Tue Apr 1 10:34:39 2014 (r263985) +++ head/lib/libc/iconv/citrus_mmap.c Tue Apr 1 10:36:11 2014 (r263986) @@ -1,5 +1,5 @@ /* $FreeBSD$ */ -/* $NetBSD: citrus_mmap.c,v 1.3 2005/01/19 00:52:37 mycroft Exp $ */ +/* $NetBSD: citrus_mmap.c,v 1.4 2011/10/15 23:00:01 christos Exp $ */ /*- * Copyright (c)2003 Citrus Project, Modified: head/lib/libc/iconv/citrus_prop.c ============================================================================== --- head/lib/libc/iconv/citrus_prop.c Tue Apr 1 10:34:39 2014 (r263985) +++ head/lib/libc/iconv/citrus_prop.c Tue Apr 1 10:36:11 2014 (r263986) @@ -1,5 +1,5 @@ /* $FreeBSD$ */ -/* $NetBSD: citrus_prop.c,v 1.3 2006/11/22 23:47:21 tnozaki Exp $ */ +/* $NetBSD: citrus_prop.c,v 1.4 2011/03/30 08:22:01 jruoho Exp $ */ /*- * Copyright (c)2006 Citrus Project, Modified: head/lib/libc/iconv/citrus_prop.h ============================================================================== --- head/lib/libc/iconv/citrus_prop.h Tue Apr 1 10:34:39 2014 (r263985) +++ head/lib/libc/iconv/citrus_prop.h Tue Apr 1 10:36:11 2014 (r263986) @@ -1,5 +1,5 @@ /* $FreeBSD$ */ -/* $NetBSD: citrus_prop.h,v 1.3 2006/11/23 13:59:03 tnozaki Exp $ */ +/* $NetBSD: citrus_prop.h,v 1.5 2011/05/23 14:52:32 joerg Exp $ */ /*- * Copyright (c)2006 Citrus Project, @@ -82,7 +82,7 @@ struct _citrus_prop_hint_t { #define _CITRUS_PROP_HINT_NUM(name, cb) \ { name, _CITRUS_PROP_NUM, { .num = { cb } } } #define _CITRUS_PROP_HINT_END \ - { NULL, _CITRUS_PROP_NUM, { .num = { 0 } } } + { .name = NULL } __BEGIN_DECLS int _citrus_prop_parse_variable(const _citrus_prop_hint_t * __restrict, Modified: head/lib/libc/iconv/citrus_stdenc.c ============================================================================== --- head/lib/libc/iconv/citrus_stdenc.c Tue Apr 1 10:34:39 2014 (r263985) +++ head/lib/libc/iconv/citrus_stdenc.c Tue Apr 1 10:36:11 2014 (r263986) @@ -1,5 +1,5 @@ /* $FreeBSD$ */ -/* $NetBSD: citrus_stdenc.c,v 1.3 2005/10/29 18:02:04 tshiozak Exp $ */ +/* $NetBSD: citrus_stdenc.c,v 1.4 2011/11/19 18:39:58 tnozaki Exp $ */ /*- * Copyright (c)2003 Citrus Project, @@ -102,8 +102,10 @@ _citrus_stdenc_open(struct _citrus_stden ce->ce_ops->eo_cstomb == NULL || ce->ce_ops->eo_mbtowc == NULL || ce->ce_ops->eo_wctomb == NULL || - ce->ce_ops->eo_get_state_desc == NULL) + ce->ce_ops->eo_get_state_desc == NULL) { + ret = EINVAL; goto bad; + } /* allocate traits */ ce->ce_traits = malloc(sizeof(*ce->ce_traits)); Modified: head/lib/libiconv_modules/BIG5/citrus_big5.c ============================================================================== --- head/lib/libiconv_modules/BIG5/citrus_big5.c Tue Apr 1 10:34:39 2014 (r263985) +++ head/lib/libiconv_modules/BIG5/citrus_big5.c Tue Apr 1 10:36:11 2014 (r263986) @@ -1,5 +1,5 @@ /* $FreeBSD$ */ -/* $NetBSD: citrus_big5.c,v 1.12 2008/06/14 16:01:07 tnozaki Exp $ */ +/* $NetBSD: citrus_big5.c,v 1.13 2011/05/23 14:53:46 joerg Exp $ */ /*- * Copyright (c)2002, 2006 Citrus Project, @@ -92,8 +92,8 @@ typedef struct { typedef struct _BIG5Exclude { TAILQ_ENTRY(_BIG5Exclude) entry; - wint_t end; wint_t start; + wint_t end; } _BIG5Exclude; typedef TAILQ_HEAD(_BIG5ExcludeList, _BIG5Exclude) _BIG5ExcludeList; @@ -358,7 +358,7 @@ _citrus_BIG5_wcrtomb_priv(_BIG5EncodingI size_t n, wchar_t wc, _BIG5State * __restrict psenc __unused, size_t * __restrict nresult) { - unsigned char l; + size_t l; int ret; /* check invalid sequence */ Modified: head/lib/libiconv_modules/DECHanyu/citrus_dechanyu.c ============================================================================== --- head/lib/libiconv_modules/DECHanyu/citrus_dechanyu.c Tue Apr 1 10:34:39 2014 (r263985) +++ head/lib/libiconv_modules/DECHanyu/citrus_dechanyu.c Tue Apr 1 10:36:11 2014 (r263986) @@ -1,5 +1,5 @@ /* $FreeBSD$ */ -/* $NetBSD: citrus_dechanyu.c,v 1.3 2008/06/14 16:01:07 tnozaki Exp $ */ +/* $NetBSD: citrus_dechanyu.c,v 1.4 2011/11/19 18:20:13 tnozaki Exp $ */ /*- * Copyright (c)2007 Citrus Project, Modified: head/lib/libiconv_modules/EUCTW/citrus_euctw.c ============================================================================== --- head/lib/libiconv_modules/EUCTW/citrus_euctw.c Tue Apr 1 10:34:39 2014 (r263985) +++ head/lib/libiconv_modules/EUCTW/citrus_euctw.c Tue Apr 1 10:36:11 2014 (r263986) @@ -119,7 +119,7 @@ _citrus_EUCTW_count(int cs) case 1: /*FALLTHROUGH*/ case 2: - return (2^cs); + return (1 << cs); case 3: abort(); /*NOTREACHED*/ Modified: head/lib/libiconv_modules/ISO2022/citrus_iso2022.c ============================================================================== --- head/lib/libiconv_modules/ISO2022/citrus_iso2022.c Tue Apr 1 10:34:39 2014 (r263985) +++ head/lib/libiconv_modules/ISO2022/citrus_iso2022.c Tue Apr 1 10:36:11 2014 (r263986) @@ -1,5 +1,5 @@ /* $FreeBSD$ */ -/* $NetBSD: citrus_iso2022.c,v 1.19 2008/06/14 16:01:07 tnozaki Exp $ */ +/* $NetBSD: citrus_iso2022.c,v 1.20 2010/12/07 22:01:45 joerg Exp $ */ /*- * Copyright (c)1999, 2002 Citrus Project, @@ -78,9 +78,9 @@ #define CS96MULTI (3U) typedef struct { - unsigned char interm; - unsigned char final; unsigned char type; + unsigned char final; + unsigned char interm; unsigned char vers; } _ISO2022Charset; Modified: head/lib/libiconv_modules/UES/citrus_ues.c ============================================================================== --- head/lib/libiconv_modules/UES/citrus_ues.c Tue Apr 1 10:34:39 2014 (r263985) +++ head/lib/libiconv_modules/UES/citrus_ues.c Tue Apr 1 10:36:11 2014 (r263986) @@ -1,5 +1,5 @@ /* $FreeBSD$ */ -/* $NetBSD: citrus_ues.c,v 1.1 2006/11/13 15:16:31 tnozaki Exp $ */ +/* $NetBSD: citrus_ues.c,v 1.3 2012/02/12 13:51:29 wiz Exp $ */ /*- * Copyright (c)2006 Citrus Project, Modified: head/lib/libiconv_modules/VIQR/citrus_viqr.c ============================================================================== --- head/lib/libiconv_modules/VIQR/citrus_viqr.c Tue Apr 1 10:34:39 2014 (r263985) +++ head/lib/libiconv_modules/VIQR/citrus_viqr.c Tue Apr 1 10:36:11 2014 (r263986) @@ -1,5 +1,5 @@ /* $FreeBSD$ */ -/* $NetBSD: citrus_viqr.c,v 1.4 2008/06/14 16:01:08 tnozaki Exp $ */ +/* $NetBSD: citrus_viqr.c,v 1.5 2011/11/19 18:20:13 tnozaki Exp $ */ /*- * Copyright (c)2006 Citrus Project, Modified: head/lib/libiconv_modules/iconv_none/citrus_iconv_none.c ============================================================================== --- head/lib/libiconv_modules/iconv_none/citrus_iconv_none.c Tue Apr 1 10:34:39 2014 (r263985) +++ head/lib/libiconv_modules/iconv_none/citrus_iconv_none.c Tue Apr 1 10:36:11 2014 (r263986) @@ -1,5 +1,5 @@ /* $FreeBSD$ */ -/* $NetBSD: citrus_iconv_none.c,v 1.2 2003/07/01 09:42:16 tshiozak Exp $ */ +/* $NetBSD: citrus_iconv_none.c,v 1.3 2011/05/23 14:45:44 joerg Exp $ */ /*- * Copyright (c)2003 Citrus Project, Modified: head/lib/libiconv_modules/iconv_std/citrus_iconv_std.c ============================================================================== --- head/lib/libiconv_modules/iconv_std/citrus_iconv_std.c Tue Apr 1 10:34:39 2014 (r263985) +++ head/lib/libiconv_modules/iconv_std/citrus_iconv_std.c Tue Apr 1 10:36:11 2014 (r263986) @@ -1,5 +1,5 @@ /* $FreeBSD$ */ -/* $NetBSD: citrus_iconv_std.c,v 1.15 2006/11/13 19:08:19 tnozaki Exp $ */ +/* $NetBSD: citrus_iconv_std.c,v 1.16 2012/02/12 13:51:29 wiz Exp $ */ /*- * Copyright (c)2003 Citrus Project, Modified: head/lib/libiconv_modules/mapper_std/citrus_mapper_std.c ============================================================================== --- head/lib/libiconv_modules/mapper_std/citrus_mapper_std.c Tue Apr 1 10:34:39 2014 (r263985) +++ head/lib/libiconv_modules/mapper_std/citrus_mapper_std.c Tue Apr 1 10:36:11 2014 (r263986) @@ -1,5 +1,5 @@ /* $FreeBSD$ */ -/* $NetBSD: citrus_mapper_std.c,v 1.8 2006/09/11 13:06:33 tnozaki Exp $ */ +/* $NetBSD: citrus_mapper_std.c,v 1.10 2011/11/19 18:48:39 tnozaki Exp $ */ /*- * Copyright (c)2003, 2006 Citrus Project, @@ -174,8 +174,11 @@ rowcol_parse_variable_compat(struct _cit n = be32toh(rcx->rcx_src_row_end); if (m + n > 0) { ret = set_linear_zone(lz, m, n); - if (ret != 0) + if (ret != 0) { + free(rc->rc_src_rowcol); + rc->rc_src_rowcol = NULL; return (ret); + } ++rc->rc_src_rowcol_len, ++lz; } m = be32toh(rcx->rcx_src_col_begin);