Skip to content

fix(rename): short-circuit from == to to avoid an infinite loop - #761

Merged
ashvardanian merged 1 commit into
unum-cloud:main-devfrom
desertfury:fix/fuzz-rename-self-infinite-loop
May 24, 2026
Merged

ashvardanian merged 1 commit into
unum-cloud:main-devfrom
desertfury:fix/fuzz-rename-self-infinite-loop

Conversation

@desertfury

Copy link
Copy Markdown
Contributor

In a multi-vector index, rename(from, from) entered an infinite loop: each iteration popped one {from, slot} entry, immediately re-emplaced it as {to == from, slot}, and the next pop_first(from) happily picked up the just-inserted copy. The fuzzer timed out on the path.

Returns success with result.completed == 0 when from == to.

@desertfury
desertfury force-pushed the fix/fuzz-rename-self-infinite-loop branch from 16f5457 to 4767fd7 Compare May 24, 2026 10:26
In a multi-vector index, `rename(from, from)` would keep removing and re-inserting entries under the same key, so the lookup loop could continue finding the freshly inserted slot forever.

Return before taking the write lock when the source and destination keys match, reporting the number of matching entries as completed no-op renames.

Co-authored-by: Mikhail Chichvarin <[email protected]>

Co-authored-by: Mikhail Chichvarin <[email protected]>

Co-authored-by: Ash Vardanian <[email protected]>
@ashvardanian
ashvardanian force-pushed the fix/fuzz-rename-self-infinite-loop branch from 4767fd7 to fa9538a Compare May 24, 2026 11:39
@ashvardanian
ashvardanian changed the base branch from main to main-dev May 24, 2026 11:41
@ashvardanian
ashvardanian merged commit 830f31a into unum-cloud:main-dev May 24, 2026
ashvardanian pushed a commit that referenced this pull request May 24, 2026
### Patch

- Fix: Refuse operations without reserved thread contexts (#757) (b8d3403)
- Fix: Checked arithmetic for allocation sizes (#763) (89da7c5)
- Fix: Preserve hash lookup capacity across thread reserves (#765) (3cf843b)
- Fix: Guard quantized casts against zero-magnitude inputs (#758) (0c903f4)
- Fix: Refuse missing metrics in C change-metric API (#760) (490c1b2)
- Fix: Short-circuit self-renames (#761) (830f31a)
- Fix: Keep `vectors_lookup_` capacity after `clear()` #759 (9d77be5)
- Improve: Serialize concurrent same-`Index` Python access with a mutex (47528b5)
- Improve: Test GIL-release contract and progress-callback path (a598493)
- Improve: Release Python GIL during long index operations (d8be67d)
- Fix: Restore `ring_gt::try_push` return value (18c44ee)
- Fix: Stop JavaScript `Remove` loop after exception throw (f3e1052)
- Fix: Stop `usearch_init` on `make` failure (2aa0070)
- Fix: Stop C-ABI metadata readers on failure (34889ee)
- Fix: Report OOM from C-ABI thread-limit changers (ad24056)
- Fix: Bounded probe in `equal_iterator_gt::operator++` (b779c47)
- Fix: Resize cast buffer in `change_metric` for new bytes-per-vector (d544745)
- Fix: Eager-reserve thread contexts in `index_dense_gt::make` (#755) (b296566)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants