Skip to content

Commit

Permalink
Fix a bug in the apply_reads method causing a memory corruption
Browse files Browse the repository at this point in the history
Make `apply_reads` to check if the deque node is still valid before moving it in
the deque.
  • Loading branch information
tatsuya6502 committed Aug 12, 2023
1 parent ef90224 commit 84c160c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/sync/base_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -775,7 +775,9 @@ where
Ok(Hit(hash, entry, timestamp)) => {
freq.increment(hash);
entry.set_last_accessed(timestamp);
deqs.move_to_back_ao(&entry)
if entry.is_admitted() {
deqs.move_to_back_ao(&entry);
}
}
Ok(Miss(hash)) => freq.increment(hash),
Err(_) => break,
Expand Down

0 comments on commit 84c160c

Please sign in to comment.