MFC r336115;

libiconv: correct undefined behavior.

Detected on NetBSD:
# nm /usr/lib/libc.so|grep sanit
    /public/src.git/lib/libc/citrus/modules/citrus_mapper_std.c:173:8:
runtime error: left shift of 1 by 31 places cannot be represented in type 'int'

Obtained from:	NetBSD (CVS Rev. 1.11)
This commit is contained in:
Pedro F. Giffuni 2018-07-16 00:28:33 +00:00
parent 390a21dac2
commit ad39f6294d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/stable/10/; revision=336324

View File

@ -1,5 +1,5 @@
/* $FreeBSD$ */ /* $FreeBSD$ */
/* $NetBSD: citrus_mapper_std.c,v 1.10 2011/11/19 18:48:39 tnozaki Exp $ */ /* $NetBSD: citrus_mapper_std.c,v 1.11 2018/06/11 18:03:38 kamil Exp $ */
/*- /*-
* Copyright (c)2003, 2006 Citrus Project, * Copyright (c)2003, 2006 Citrus Project,
@ -159,7 +159,7 @@ rowcol_parse_variable_compat(struct _citrus_mapper_std_rowcol *rc,
rc->rc_dst_invalid = be32toh(rcx->rcx_dst_invalid); rc->rc_dst_invalid = be32toh(rcx->rcx_dst_invalid);
rc->rc_dst_unit_bits = be32toh(rcx->rcx_dst_unit_bits); rc->rc_dst_unit_bits = be32toh(rcx->rcx_dst_unit_bits);
m = be32toh(rcx->rcx_src_col_bits); m = be32toh(rcx->rcx_src_col_bits);
n = 1 << (m - 1); n = 1U << (m - 1);
n |= n - 1; n |= n - 1;
rc->rc_src_rowcol_bits = m; rc->rc_src_rowcol_bits = m;
rc->rc_src_rowcol_mask = n; rc->rc_src_rowcol_mask = n;