Module Name: src Committed By: kamil Date: Fri Feb 21 22:04:06 UTC 2020
Modified Files: src/lib/libc/db/hash: hash.h Log Message: Avoid undefined behavior in *BIT macros hash_page.c:792:2, left shift of 1 by 31 places cannot be represented in type 'int' hash_page.c:855:2, left shift of 1 by 31 places cannot be represented in type 'int' hash_page.c:779:3, left shift of 1 by 31 places cannot be represented in type 'int' To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/lib/libc/db/hash/hash.h 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/db/hash/hash.h diff -u src/lib/libc/db/hash/hash.h:1.16 src/lib/libc/db/hash/hash.h:1.17 --- src/lib/libc/db/hash/hash.h:1.16 Wed Nov 18 18:22:42 2015 +++ src/lib/libc/db/hash/hash.h Fri Feb 21 22:04:06 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: hash.h,v 1.16 2015/11/18 18:22:42 christos Exp $ */ +/* $NetBSD: hash.h,v 1.17 2020/02/21 22:04:06 kamil Exp $ */ /*- * Copyright (c) 1990, 1993, 1994 @@ -156,9 +156,9 @@ typedef struct htab { /* Memory reside #define BITS_PER_MAP 32 /* Given the address of the beginning of a big map, clear/set the nth bit */ -#define CLRBIT(A, N) ((A)[(N)/BITS_PER_MAP] &= ~(1<<((N)%BITS_PER_MAP))) -#define SETBIT(A, N) ((A)[(N)/BITS_PER_MAP] |= (1<<((N)%BITS_PER_MAP))) -#define ISSET(A, N) ((A)[(N)/BITS_PER_MAP] & (1<<((N)%BITS_PER_MAP))) +#define CLRBIT(A, N) ((A)[(N)/BITS_PER_MAP] &= ~(1U<<((N)%BITS_PER_MAP))) +#define SETBIT(A, N) ((A)[(N)/BITS_PER_MAP] |= (1U<<((N)%BITS_PER_MAP))) +#define ISSET(A, N) ((A)[(N)/BITS_PER_MAP] & (1U<<((N)%BITS_PER_MAP))) /* Overflow management */ /*