The vulnerability, as described, affects the sized constructors, reserve(), and rehash() methods of absl::{flat,node}hash{set,map}. These public-facing methods utilize the absl::container_internal::raw_hash_set class for their underlying implementation. The provided commit patch (5a0e2cb5e3958dd90bb8569a2766622cb74d90c1) directly modifies raw_hash_set.h and raw_hash_set.cc to introduce upper-bound checks on size arguments.
The vulnerability existed because these internal methods (raw_hash_set constructor, rehash, and reserve) did not properly validate their size parameters. When called with excessively large values (originating from the public API), these methods would proceed to calculate memory requirements (e.g., via NormalizeCapacity, GrowthToLowerboundCapacity, and ultimately RawHashSetLayout::alloc_size within the resize operation). This calculation could lead to an integer overflow, resulting in a much smaller memory buffer being allocated than intended. Subsequent operations on the container would then cause out-of-bounds memory writes.
The identified vulnerable functions are the specific methods within absl::container_internal::raw_hash_set where these crucial checks were missing and subsequently added by the patch. These are the functions that directly contained the flawed logic leading to the integer overflow and heap buffer overflow. During exploitation, these functions (or functions they call like resize) would be on the stack trace at the point where the overflow or miscalculation occurs.