Module Name:    src
Committed By:   kamil
Date:           Mon Jun 11 18:03:38 UTC 2018

Modified Files:
        src/lib/libc/citrus/modules: citrus_mapper_std.c

Log Message:
Correct Undefined Behavior in libc/citrus

Unportable left shift reported with MKSANITIZER=yes USE_SANITIZER=undefined:

# 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'

Sponsored by <The NetBSD Foundation>


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/lib/libc/citrus/modules/citrus_mapper_std.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/citrus/modules/citrus_mapper_std.c
diff -u src/lib/libc/citrus/modules/citrus_mapper_std.c:1.10 src/lib/libc/citrus/modules/citrus_mapper_std.c:1.11
--- src/lib/libc/citrus/modules/citrus_mapper_std.c:1.10	Sat Nov 19 18:48:39 2011
+++ src/lib/libc/citrus/modules/citrus_mapper_std.c	Mon Jun 11 18:03:38 2018
@@ -1,4 +1,4 @@
-/*	$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,
@@ -28,7 +28,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: citrus_mapper_std.c,v 1.10 2011/11/19 18:48:39 tnozaki Exp $");
+__RCSID("$NetBSD: citrus_mapper_std.c,v 1.11 2018/06/11 18:03:38 kamil Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include <assert.h>
@@ -170,7 +170,7 @@ rowcol_parse_variable_compat(struct _cit
 	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;

Reply via email to