From 3c13579fcf8ab20d1831fdb2043d9fd5f76675ac Mon Sep 17 00:00:00 2001 From: Daan Date: Tue, 18 Feb 2025 15:55:45 -0800 Subject: [PATCH] fix pre-processor overflow (issue #1017) --- src/segment-map.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/segment-map.c b/src/segment-map.c index 5809342c..ff6144a4 100644 --- a/src/segment-map.c +++ b/src/segment-map.c @@ -30,7 +30,12 @@ terms of the MIT license. A copy of the license can be found in the file #define MI_SEGMENT_MAP_PART_ENTRIES (MI_SEGMENT_MAP_PART_SIZE / MI_INTPTR_SIZE) #define MI_SEGMENT_MAP_PART_BIT_SPAN (MI_SEGMENT_ALIGN) #define MI_SEGMENT_MAP_PART_SPAN (MI_SEGMENT_MAP_PART_BITS * MI_SEGMENT_MAP_PART_BIT_SPAN) + +#if MI_SEGMENT_MAP_PART_SPAN > MI_SEGMENT_MAP_MAX_ADDRESS +#define MI_SEGMENT_MAP_MAX_PARTS (1) +#else #define MI_SEGMENT_MAP_MAX_PARTS ((MI_SEGMENT_MAP_MAX_ADDRESS / MI_SEGMENT_MAP_PART_SPAN) + 1) +#endif // A part of the segment map. typedef struct mi_segmap_part_s {