Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libc/citrus/modules Correct Undefined Behavior in libc/c...
details: https://anonhg.NetBSD.org/src/rev/ea717184fd22
branches: trunk
changeset: 319785:ea717184fd22
user: kamil <kamil%NetBSD.org@localhost>
date: Mon Jun 11 18:03:38 2018 +0000
description:
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>
diffstat:
lib/libc/citrus/modules/citrus_mapper_std.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diffs (27 lines):
diff -r 8602df74e4de -r ea717184fd22 lib/libc/citrus/modules/citrus_mapper_std.c
--- a/lib/libc/citrus/modules/citrus_mapper_std.c Mon Jun 11 17:45:50 2018 +0000
+++ b/lib/libc/citrus/modules/citrus_mapper_std.c Mon Jun 11 18:03:38 2018 +0000
@@ -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 @@
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;
Home |
Main Index |
Thread Index |
Old Index