diff options
author | Pedro F. Giffuni <pfg@FreeBSD.org> | 2018-07-08 23:22:04 +0000 |
---|---|---|
committer | Pedro F. Giffuni <pfg@FreeBSD.org> | 2018-07-08 23:22:04 +0000 |
commit | d2e5337149200aad630bdd37450dabf6b18b28c7 (patch) | |
tree | 61a51c592a3c0af4f38a09f0d7e74df4e198049d | |
parent | b60a815e6df9b2f22e415b04f3a2229c7b68bc30 (diff) | |
download | src-d2e5337149200aad630bdd37450dabf6b18b28c7.tar.gz src-d2e5337149200aad630bdd37450dabf6b18b28c7.zip |
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)
MFC after: 1 week
Notes
Notes:
svn path=/head/; revision=336115
-rw-r--r-- | lib/libiconv_modules/mapper_std/citrus_mapper_std.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/libiconv_modules/mapper_std/citrus_mapper_std.c b/lib/libiconv_modules/mapper_std/citrus_mapper_std.c index 67b26692170d..23f88f6f2fe1 100644 --- a/lib/libiconv_modules/mapper_std/citrus_mapper_std.c +++ b/lib/libiconv_modules/mapper_std/citrus_mapper_std.c @@ -1,5 +1,5 @@ /* $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 $ */ /*- * SPDX-License-Identifier: BSD-2-Clause @@ -161,7 +161,7 @@ rowcol_parse_variable_compat(struct _citrus_mapper_std_rowcol *rc, rc->rc_dst_invalid = be32toh(rcx->rcx_dst_invalid); rc->rc_dst_unit_bits = be32toh(rcx->rcx_dst_unit_bits); m = be32toh(rcx->rcx_src_col_bits); - n = 1 << (m - 1); + n = 1U << (m - 1); n |= n - 1; rc->rc_src_rowcol_bits = m; rc->rc_src_rowcol_mask = n; |