Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion src/watcher/INotifyWatcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,21 @@
.iter()
.position(|&x| x == event.watch_descriptor)
{
Some(idx) => WatchItemIndex::try_from(idx).unwrap(),
// WatchItemIndex is u16; nothing caps watchlist length, so drop
// an unrepresentable position instead of aborting the process
// from the watcher thread (panic = "abort").
Some(idx) => match WatchItemIndex::try_from(idx) {
Ok(idx) => idx,
Err(_) => {
bun_core::scoped_log!(
watcher,
"watchlist index {} exceeds WatchItemIndex (u16), dropping event",
idx
);
events_processed += 1;
continue;
}
},

Check failure on line 468 in src/watcher/INotifyWatcher.rs

View check run for this annotation

Claude / Claude Code Review

Sentinel collision at WatchItemIndex::MAX (65535) still aborts process

The new guard drops `idx >= 65536`, but `idx == 65535` (`u16::MAX`) passes `try_from` and still aborts: `process_inotify_event_batch` initializes `last_event_id = WatchItemIndex::MAX` as a sentinel, so a batch whose first sorted event has index 65535 takes the merge branch at `i=0`, does `split_at_mut(0)`, and indexes `head[0]` on an empty slice → panic → abort. Same precondition (>65535 watched paths) and failure class this PR targets; `WindowsWatcher.rs:515-517` already widened the sentinel to
Comment thread
robobun marked this conversation as resolved.
Outdated
None => {
events_processed += 1;
continue;
Expand Down
Loading