AFLplusplus / AFLplusplus/LibAFL

Redundant Borrowing and Double Mapping in MappedCrossoverInsertMutator::mutate

Aperta
#3,731 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Rust
Stelle
2.6k
Fork
481
Merge medio
2g 30m
PR unite (30g)
16

Descrizione

### Description

The `MappedCrossoverInsertMutator::mutate` function performs redundant operations when accessing and mapping the corpus input:

1. The testcase is borrowed twice using `get_from_all(id)?.borrow_mut()`.
2. The input is loaded and mapped twice:
- First to compute `other_size`
- Second to retrieve the mapped input for mutation
3. Additional unnecessary `unwrap()` checks increase branching complexity.

This results in:
- Redundant function calls
- Extra borrow operations
- Unnecessary memory allocations
- Reduced readability

### Expected Behavior

The mapped input and its size should be retrieved in a single borrow scope and used directly for mutation without re-loading or re-mapping.

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.