From c960f2b78634b1fd9338024d8a36d4ba84461a83 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 10 Nov 2023 23:04:35 -0800 Subject: [PATCH] di-set: port better to CHERI-64 MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit * lib/di-set.c: Include stdint.h. (hashint): Make it uintptr_t, not size_t, since it’s for use when converting to pointer and back again. This suppresses a false positive on CHERI-64. * modules/di-set (Depends-on): Add stdint. --- ChangeLog | 7 +++++++ lib/di-set.c | 3 ++- modules/di-set | 1 + 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index c83d73ca3d..aae72a1987 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2023-11-10 Paul Eggert + di-set: port better to CHERI-64 + * lib/di-set.c: Include stdint.h. + (hashint): Make it uintptr_t, not size_t, since it’s for use + when converting to pointer and back again. This suppresses + a false positive on CHERI-64. + * modules/di-set (Depends-on): Add stdint. + stdio: fix port to older macOS * lib/stdio.in.h: It’s pre macOS 13, not pre macOS 10.13. Problem reported by Sevan Janiyan in: diff --git a/lib/di-set.c b/lib/di-set.c index 6705a148ab..f84fc9d958 100644 --- a/lib/di-set.c +++ b/lib/di-set.c @@ -24,13 +24,14 @@ #include "ino-map.h" #include +#include #include /* The hash package hashes "void *", but this package wants to hash integers. Use integers that are as large as possible, but no larger than void *, so that they can be cast to void * and back without losing information. */ -typedef size_t hashint; +typedef uintptr_t hashint; #define HASHINT_MAX ((hashint) -1) /* Integers represent inode numbers. Integers in the range diff --git a/modules/di-set b/modules/di-set index ef151c4571..2da14ad48d 100644 --- a/modules/di-set +++ b/modules/di-set @@ -8,6 +8,7 @@ lib/di-set.h Depends-on: ino-map hash +stdint configure.ac: -- 2.39.5