diff options
-rw-r--r-- | NEWS | 1 | ||||
-rw-r--r-- | elf/dl-find_object.c | 8 |
2 files changed, 9 insertions, 0 deletions
@@ -19,6 +19,7 @@ The following bugs are resolved with this release: [32052] Name space violation in fortify wrappers [32137] libio: Attempt wide backup free only for non-legacy code [32231] elf: Change ldconfig auxcache magic number + [32245] glibc -Wstringop-overflow= build failure on hppa Version 2.40 diff --git a/elf/dl-find_object.c b/elf/dl-find_object.c index 449302e..ae18b43 100644 --- a/elf/dl-find_object.c +++ b/elf/dl-find_object.c @@ -662,6 +662,14 @@ _dl_find_object_update_1 (struct link_map **loaded, size_t count) = _dlfo_loaded_mappings[!active_idx]; size_t remaining_to_add = current_used + count; + /* remaining_to_add can be 0 if (current_used + count) wraps, but in practice + this is not possible as it represent counts of link maps. Link maps have + sizes larger than 1 byte, so the sum of any two link map counts will + always fit within a size_t without wrapping around. This check ensures + that target_seg is not erroneously considered potentially NULL by GCC. */ + if (remaining_to_add == 0) + __builtin_unreachable (); + /* Ensure that the new segment chain has enough space. */ { size_t new_allocated |