diff options
| author | sentientwaffle <sentientwaffle@gmail.com> | 2023-06-09 12:52:36 -0700 |
|---|---|---|
| committer | Veikka Tuominen <git@vexu.eu> | 2023-06-10 02:24:35 +0300 |
| commit | f04e65bc09ab77eafc317b2d2981970509aae6af (patch) | |
| tree | 707964d29fbc65bc693fe543a47c14f5231f4e52 /lib/std/Build/Step | |
| parent | 99fe2a23c0b45395be3c71192aeaeaea77e1fb0c (diff) | |
| download | zig-f04e65bc09ab77eafc317b2d2981970509aae6af.tar.gz zig-f04e65bc09ab77eafc317b2d2981970509aae6af.zip | |
std.hash_map: fetchRemove increment available
To avoid leaking slots, `fetchRemove` must increment `available` (when the "fetch" succeeds).
Without the `available += 1`, the added test `"std.hash_map repeat fetchRemove"` fails with
run test std-x86-linux-none-Debug: error: thread 432734 panic: integer overflow
.../zig/lib/std/hash_map.zig:1365:28: 0x6471d5 in getOrPutAssumeCapacityAdapted__anon_47495 (test)
self.available -= 1;
^
.../zig/lib/std/hash_map.zig:1308:62: 0x616950 in getOrPutAssumeCapacityContext (test)
const result = self.getOrPutAssumeCapacityAdapted(key, ctx);
^
Alternatively, `fetchRemove` could call `removeByIndex`, though that would entail calling `header()` twice instead of once.
Diffstat (limited to 'lib/std/Build/Step')
0 files changed, 0 insertions, 0 deletions
